Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [redirection]

Redirection in Drupal means sending the users to a different page.

Filter by
Sorted by
Tagged with
0
votes
0answers
38 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
1answer
19 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 ...
0
votes
1answer
37 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
0answers
27 views

Redirect from a path

I have a routing.yml file with a path which triggers a controller method. When the controller method finishes the operation I want to return user to the page he came from originally. I don't want to ...
1
vote
1answer
37 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
0answers
28 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, ...
0
votes
0answers
19 views

How can we add header in redirect url just like adding header in curl

I am trying to call an external url from a drupal environment using RedirectResponse. In this request I need to add a custom header. I tried it using cURL and I got the custom header in the request ...
0
votes
0answers
19 views

How set a custom redirect confirmation path to webform programmatically

i'm trying to set a custom URL to redirect when the process of webform submit is completed without use the confirmation settings of webform. I Actually try with this: $entity->setSettingOverride('...
0
votes
0answers
20 views

Repointing a site a subdomain

I have created a new Drupal 8 site in a subdomain of an existing Drupal 6 site. The new site sits in public_html/dev - so the url for it is dev.mydomain.com. What is the best way to redirect ...
-1
votes
1answer
15 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
0answers
14 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
0answers
44 views

User not logged in

I have a Drupal 8 installation and it is not logging in the users. Tried Google search and applied all solutions like setting cookie_domain, trusted_host_patterns and clearing cache. Note that, if ...
0
votes
1answer
55 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
0answers
60 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 ...
-1
votes
1answer
36 views

How to make redirect in jQuery callback function? [duplicate]

When I use this $form_state->setResponse(new TrustedRedirectResponse($url, 302)); in submitForm() it works fine. But when I try to use it in jQuery callback function it doesn't redirect me. How to ...
0
votes
1answer
28 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
2answers
77 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
0answers
18 views

Non secure links redirect to homepage rather than serving over HTTPS

I have a site that is forcing HTTPS so that any links get redirected to being loaded securely if they aren't already so. For the most part, this works but there are a few links that work fine when ...
0
votes
0answers
22 views

Rules 301 redirect?

I have a rule which checks for URL segment and redirects to homepage. It works good but redirect is 302, not 301. Is it possible to use somehow 301 redirect or that can be achieved only via .htaccess?...
0
votes
0answers
52 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 ...
0
votes
0answers
20 views

Execute some “code” when an external link is clicked

I'm very new to Drupal 8 and would really appreciate any advice about the best way to tackle my problem. I am creating an online video catalog that indexes videos from external vendors. All the videos ...
2
votes
1answer
115 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 ...
1
vote
0answers
24 views

404 not re-directing. Error: Call to a member function isSuccessful() on null

Having an issue with Drupal 8 not re-directing to our 404 page. The screen displays the ubiquitous "The website encountered an unexpected error. Please try again later." When I look in the recent ...
0
votes
0answers
20 views

Redirect old URL to new URL via htaccess with path

I am using HTTPS and WWW only rules in Drupal 7's .htaccess like: RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ensure https RewriteCond %{...
0
votes
1answer
80 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
0answers
38 views

id 'Redirect::create' status code optional?

I have a landing page generated from a social media account, at the landing page page 1 a backend decision is made, if a specific cookie is found they are taken to page 2, if it is not found they are ...
0
votes
1answer
42 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 ...
3
votes
1answer
218 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 ...
-1
votes
1answer
37 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
1answer
36 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
0answers
26 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
0answers
171 views

Is there a way to open redirected links in new tab?

I am using redirect module from my Drupal 8 website to some external website. Is there a way to force to open the redirected links in new tab?
0
votes
0answers
27 views

language redirect need more restricted control

I installed my drupal site with default English language. Then I added French language and change the default language to French, the original path following the domain thus append a parent path of /...
0
votes
1answer
27 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
1answer
156 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()) { ...
2
votes
1answer
135 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
1answer
145 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
2answers
44 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 ...
1
vote
3answers
958 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
1answer
105 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
1answer
31 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 ...
4
votes
1answer
983 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
1answer
126 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
1answer
218 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
1answer
204 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 ...
1
vote
1answer
555 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. ...
0
votes
2answers
299 views

How to disable redirection to the node after node form submission

I have a node form exposed in the front-end to allow visitors to add their organisation to the list of partners. Below the form, I have exposed view block with the list of existing partners. When a ...
2
votes
4answers
422 views

How do I redirect after saving the user account with $user->save()?

How can I redirect users in a custom module after saving a user account with $user->save()? It always goes to the user profile after saving and I want to redirect to a custom page. function ...
1
vote
1answer
51 views

Redirect user on specified route

I know we can easily redirect a path to another path with Redirect module, but what I want to do is more complicated, my condition is when the user has a specified IP and the route is matched with to ...
0
votes
3answers
2k views

How to redirect from URL with trailing slash to one without

We are using the Redirect module 8.x-1.2 with Drupal 8.5.6. When generating URLs, we are finding that a trailing slash is added to the end of the URL, and this is creating a 503 error code. How ...