Questions tagged [redirection]
Redirection in Drupal means sending the users to a different page.
834
questions
0
votes
1
answer
56
views
Custom module interfering with CSS on /user page
I am having trouble with a custom module. When my site is working properly, the /user page loads 4 CSS files. After rebuilding the cache, only three files load. It's not a 404, Drupal doesn't even try ...
0
votes
1
answer
395
views
How can I create 301 redirects from "unclean" URLs?
I am moving a Wordpress site to Drupal and want to ensure that proper 301 redirects are in place for SEO purposes.
The old urls are in the form of: http:www.domain.com/?page_id=123
I was hoping ...
0
votes
1
answer
32
views
How to show or hide some content on a node view using Page Manager based on the url destination?
After certain fields have been set on the edit node form and saved, I don't want the node author to change these anymore and therefore I have created a new variant with a response code "301 permanent ...
0
votes
1
answer
97
views
What is the best way to redirect node to node
I am trying to figure out what is the best way to create a redirect from one node to another. For example, say we have two nodes:
node/1 | path-one
node/2 | path-two
I created the following redirect:...
0
votes
1
answer
158
views
Disable cache on base url for redirecting unauthenticated users
I am trying to redirect unauthenticated users. So anytime an unauthenticated user tries to get to the base url, redirect them to an external url. Currently works, but continues to redirect to the ...
4
votes
1
answer
1k
views
How to implement StackMiddleware for a redirection correctly?
I'm working on a redirection (for unauthenticated users) for my Drupal 8 site. Currently, the redirection works however, the redirection persists even after user is authenticated. I found this article ...
1
vote
0
answers
63
views
How to make EventSubscriber run on every page load? [duplicate]
Tripped up on how to make my EventSubscriber code run on every page load. In my src/EventSubscriber/RedirectAnonymousSubscriber.php file here's my code:
<?php
namespace Drupal\mymodule\...
0
votes
2
answers
526
views
Redirecting Anonymous Users to external URL on Drupal 8 site
I am attempting to create a custom module that redirects anonymous/unauthenticated users away from the site. This site is only supposed to be used by admins, so in order to access it, they must type /...
0
votes
1
answer
468
views
Redirect from within controller always goes to home page
I have a custom module named rsc.
My Default 404 (not found) page is set to /page-not-found in Basic site settings.
My rsc.routing.yml file contains
rsc.pageNotFound:
path: '/page-not-found'
...
0
votes
1
answer
231
views
The page isn’t redirecting properly
I have been trying to intercept a page request from /node/nid which is of type the_content_type and then appending some facet query parameters to it which is something like this
?f[0]=city%3A160&...
1
vote
3
answers
446
views
Where and how to conditionally redirect old aliases to new aliases
We are replacing a website with a new version. The domain is the same, but URL aliases in the new website are different.
In many cases, I can use an old alias to calculate its corresponding new ...
0
votes
1
answer
20
views
Send view field in URL - Drupal
I have a search page created with embedded filters in Drupal 8 View. In the list of fields I have a fields - [Field_program_id]. I also have a button 'Learn more' when clicking this button I want to ...
1
vote
1
answer
45
views
What is the proper way to show a visitor an error?
I'm using a custom submit handler for a Webform, which POSTs important form data to another API. That part works, but on occasion there may be random network errors that prevent a successful ...
1
vote
2
answers
35
views
What rule to use to redirect users, unless already redirected?
I'd like users with certain roles to be redirected to the page /civicrm when they login, unless they've already been redirected elsewhere. For example, an email might have a link that directs them to ...
0
votes
0
answers
44
views
How to set a theme for a 403 access denied?
When a user clicks a link to a Drupal site and are denied access because they need to login, they get a 403 access denied screen inviting them to login. I want to set a responsive theme because some ...
0
votes
1
answer
167
views
redirection in htaccess file
I'm working on Drupal7.
I want to redirect all the URl's to external domain except some.
Below rewrite I have added in .htaccess file and its working fine.
RewriteCond %{REQUEST_URI} !/user.*$
...
0
votes
3
answers
879
views
How to redirect a user on login?
I have a registration form, when submitted, the user gets logged in automatically.
I want to redirect the users to a specific page on login. Whether they are logged in using the login form or through ...
1
vote
1
answer
98
views
Redirect from route when the controller has been changed [duplicate]
I'm trying to redirect to an external URL in a custom controller whenever I land on the 404 page.
Right now I alter the controller destination in a route subscriber like this:
public function ...
0
votes
0
answers
55
views
Can I use KernelEvents::EXCEPTION to make exceptions for my own code?
I've written code for a custom module in my .MODULE file that looks like this.
function cookie_authentication_node_access(NodeInterface $node, $op, AccountInterface $account) {
if ($account->...
0
votes
1
answer
45
views
Redirect to view display after form submission
I'm using a form_alter hook to add a custom submit callback. I want to redirect the user to a particular page display of a view. However, I'm having trouble figuring out how to specify the path.
In ...
1
vote
1
answer
434
views
How to get the uncached version of request headers?
We need to programmatically get the request headers using the mymodule_preprocess_page hook. To do this we tried the following, however, because we have CDN, Varnish, and Drupal Cache all enabled, the ...
0
votes
1
answer
105
views
Endless redirect on paths containing question marks
A similar question was posted here: EventSubscriber endless redirect
But I haven't quite been able to implement a workable solution.
On Drupal 8.73: Basically we have a custom module that is ...
0
votes
0
answers
40
views
Can't go anywhere from user edit page after login
Having an issue with a certain user that is not reflected on other users, when this particular user is logging in he isn't redirected to homepage or to
admin/dashboard
but to
user/edit
page, ...
-1
votes
1
answer
32
views
Redirect domain to www, but on subdomain do not use www
I have a multilanguage website. The main language is English and the second language is Spanish.
I need to have all the traffic using this domains:
English domain: www.example.com
Spanish domain: es....
0
votes
0
answers
131
views
When using /user/login as the default 403 access denied page, how can I add the tabs block to the login form?
After removing the anonymous permission to view published content, and setting the 403 access denied page to /user/login, the tabs block is no longer shown with the user login form.
The tabs block ...
0
votes
1
answer
621
views
Redirect user after one-time-login
When users get an email with one time login link, they will arrive on a page to set their password (separated form via Password Separate Form)
But once they click submit, it doesn't redirect them to ...
0
votes
0
answers
65
views
How to stop a local database from launching the online website?
I'm a designer and new to Drupal. been studying for a couple of months creating sites for personal learning. I started working in a company that had a Drupal 7 website. I studied, learned it and ...
0
votes
1
answer
40
views
Redirecting old file URLs (no pattern)
running Drupal 7.65.
Our previous website manager moved us from Drupal 6 to Drupal 7 and cleaned up the file structure on our server.
While all the files that are now on our website have clean and ...
-2
votes
2
answers
85
views
How do I redirect a user to the front page after logging in? [closed]
Is there a way to redirect users to the front page after they log in, without using any additional modules other than the core modules. Right now they are redirected to their profiles.
0
votes
0
answers
391
views
How to redirect to the previous page after submission of a form in a block
I have a view of nodes of type task.
I created a block with an inline task create form (using form block module)
The block is next to the view on the same page.
Question:
After creating a new task by ...
4
votes
1
answer
1k
views
Disabling Page Cache for Redirect Response
I've implemented a conditional redirect on my site via an event subscriber and returning a redirect response. It's working but, I believe due to the page_cache module is getting cached for anonymous ...
0
votes
2
answers
599
views
How to use a RedirectResponse with a # (hash)?
I have this code:
$event->setResponse(new RedirectResponse(base_path().'mypage#actions_clicker'));
It redirects to /mypage, but it doesn not include the #actions_clicker part. How do I make ...
0
votes
1
answer
175
views
Redirecting to a page based on the sub-domain
How can I redirect visitors to a specific page based on the sub-domain? For example:
www.site.com goes to frontpage
checklist.site.com goes to checklist.site.com/checklist
My server is set to work ...
4
votes
1
answer
948
views
How do I avoid caching a redirect response from a form?
I have a Drupal 8 form used by authenticated users which sometimes needs to redirect based on the presence of absence of something in session. I don't want the redirect to be cached.
My form is ...
0
votes
1
answer
84
views
Getting redirect to phantom page /user/register/thankyou
In Drupal 8, I created a page with the path alias /user/register/thankyou to redirect users to after registration. Later, I changed the url of this page to simply be /register/user/thankyou. I have ...
1
vote
1
answer
42
views
Links in stage environments are absolute and send users to live enviroment
This problem has been driving crazy for years.
whenever I create a stage environment of a site, I copy the database from the production site. some of the links there - whether in the menus or in the ...
1
vote
0
answers
35
views
Multiple sites in same subfolder
I have multiple very similar drupal sites (each for a specific year of some project): 2012.somain.tld, 2013.domain.tld, etc. Their files are organized in subdirectories (2012, 2013, etc.) of ...
0
votes
1
answer
32
views
What is the best way to forward visitors to my homepage to an external site but leave the backlinks accessible?
Maybe not distinctly a Drupal question, I have an older Drupal 7 site that I want to leave up for backlinks, but any new visitors I want to redirect to a new external website. So domain.com would ...
0
votes
1
answer
1k
views
Redirect to a specific page in ajax callback
How can I redirect to a specific page in an ajax callback using Drupal 7, I've already tested this method:
function my_ajax_callback($form, &$form_state) {
if (!user_is_anonymous()) {
...
3
votes
1
answer
619
views
How to dynamically redirect user from /foo/X to /bar/X?
So far I did the following:
I've installed Redirect and Token modules.
I've applied the patch for Redirect module to support wildcards.
I've applied the patch for Redirect module to implement ...
1
vote
1
answer
322
views
How to find where are defined tokens for Redirect?
After enabling Token and Redirect modules, I've found at /admin/help/token that I can use Redirect tokens. For example:
However, I've got the problem finding the place where and how these tokens are ...
2
votes
2
answers
165
views
How do I display an error message on a basic page when the user does not have permissions to see the nested view inside the basic page?
I have a basic page, and inside of that basic page I have a view "newsletters". The view "newsletters" has permissions set on it based on role, so only admin and subscribers can see it. How can I ...
0
votes
3
answers
5k
views
How to do a redirect in node.html.twig?
I'm trying to do a redirect on my node.html.twig template based on the content type because I'm using views for my content.
I tried this:
{% do redirect('/example') %}
or this:
{% redirect '/...
0
votes
1
answer
212
views
Error is raised when I try to redirect webform submission to external webpage with query string
Dear Drupal community,
I created a webform using the webforms module in Drupal 8 in order to add information to a webpage. Since I don't want to update the webpage manually I'd like to automatize ...
1
vote
1
answer
39
views
Alter menu link if logged in
I have a regular node in my main menu that:
if an anonymous user clicks on it, the node should be shown regularly
if a logged in user clicks on it, there should be a redirect to an external website
...
6
votes
2
answers
3k
views
How to redirect user page to front page for specific roles
I want to redirect every users page to front page? like if user page url is /user/97 then it redirect to front page if user is not administrator. I want user page inaccessible to other users but only ...
0
votes
1
answer
164
views
How can I build a redirect from submitted form values?
I'm working on a short weather app.
What I want to do, is to catch name of the input of city and redirect users to the city's page URL after submit.
function form_findYourCity_submit($form, &$...
0
votes
1
answer
721
views
Remove index.php from imported urls
I made some migration of pretty old website to d8. And urls ported fine from latest WP version:
/user1/article-name1
/user2/2009/article-about-something
/user3/2017/11/06/article-something
But from ...
-2
votes
1
answer
551
views
Redirect users to home page if already logged in
I am using a third party authentication mechanism to authenticate users.
On successful authentication, I am able to redirect the users to the front page using the RedirectResponse class. If logged-in ...
0
votes
1
answer
2k
views
Customize "Access Denied" (403) page for specific content type [closed]
I'm currently setting up a simple LMS in Drupal 8 and would like to customize the Access Denied page as follows:
Anonymous users should be redirected to the Login page, when they hit a 403 error.
...