Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [redirect]

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

0
votes
0answers
14 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
28 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
29 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
32 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
75 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
31 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
34 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 ...
0
votes
0answers
19 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
45 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
22 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
23 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
36 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
97 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
59 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
37 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
371 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
44 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 ...
0
votes
1answer
26 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 ...
3
votes
1answer
185 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
39 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
52 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
102 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
218 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
106 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
327 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
49 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
976 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 ...
0
votes
1answer
115 views

Problem with programmatically creating a redirect

Background Client has Event webforms hosted externally by a marketing automation service, leading to an unusual situation: a node of Event content type should have its summary displayed in certain ...
1
vote
1answer
34 views

How to redirect all variations of a domain to https version? [duplicate]

Google has started punishing non https sites both in SEO and their browsers. So I guess we must make sure that all our clients are using https Assuming that I have a domain example.com I would like ...
2
votes
2answers
59 views

Force redirect back to password form until password got set after one-time-login

When my users click on a one-time-password-reset link then I log them in and then show them a page where they can choose their new password. Problem is that there are two additional links on that page ...
0
votes
1answer
38 views

Prevent access to or redirect /user page

I'm looking to redirect or prevent access for authenticated users to the /user page. The reason being that it serves no purpose being there so would like to either remove or redirect it. The best I'...
0
votes
0answers
38 views

Set dynamic $base_url with Domain Access module to avoid redirects

If you run two URLs with Domain module like e.g. main.site.com sub.site.com main.site.com is main site, so if you go to sub.site.com/user and login, it redirects back to main.site.com. This happens ...
0
votes
1answer
108 views

Redirect after updating nodes [duplicate]

I've to redirect users, after updating a node, to /node/NID path and not to /node/NID/latest (I'm using content moderation). I've tried to add this on hook_node_update() but have been ignored (...
1
vote
0answers
35 views

Some URLs need a trailing slash or it redirects to the home page

I have cloned my production site to a dev environment. Both are Drupal 7.58 running on a WIMP stack if that matters. Both are using clean URLs. In the dev site this url http://mysite/about-us ...
0
votes
1answer
56 views

Redirect for anonymus user doesn´t work from Controller

Community, i´ve got a simple COntroller for redirect my users by visiting a special path (localhost/drupal8/check). At the moment the redirect works for the administrator and for registrated user, if ...
0
votes
1answer
69 views

How can a controller change the url reported to browser?

I have got two routes - one is for pausing mail jobs, the other one for listing them. When I click on "pause" - the pause route: does it's thing internally calls the list route with a couple of ...
1
vote
3answers
43 views

Two different front pages?

I have a website at mydomain.com. I am creating a clone of it on mydomain2.com. The only difference is that I want the landing pages to be different. Both domains are running the same codebase. How ...
0
votes
0answers
23 views

Redirect url is not working even if enabled

I am in upgrade phase of my site. After upgrade the redirect url is not working even if the status is enabled and no changes in redirect database the redirection url has stopped working. if I save ...
0
votes
1answer
18 views

Site is redirecting to old domain on button submission, files are linking to old domain [closed]

I have a D7 site at www.example.com, an old one, not updated since 2012 (Drupal version 7.34). I made a clone copy with separate clone database under dev.example.com All files like CSS are still ...
0
votes
1answer
26 views

One site, two domains

We have a single site that we'd like to have two different domains: apply.school1.edu and apply.school2.edu. The site is at apply.school1.edu and we'd simply like to create a domain apply.school2.edu ...
1
vote
1answer
370 views

Returning a custom command via AjaxResponse

I have a method that is invoked by AJAX call, and it returns an AjaxResponse. It redirects the user with RedirectCommand, added to the response. However, I would like to change it to a conditional ...
1
vote
1answer
59 views

Form state redirects do not respect https

on some forms I added custom redirects, for example on the user login form: function my_module_user_login_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) { $form_state->...
0
votes
1answer
158 views

Trigger redirect after Webform Remote Post Handler posted successfully

I've made a webform with a handler. This handler does a Remote Post towards an API. This API is actually a custom module within the Drupal install which (after some logic) passes all of the ...
0
votes
0answers
106 views

Unwanted redirection

My website's client (eole.avh.asso.fr) has been hacked following the recent hack of drupal core. We have updated the drupal core on our website, but when we try to reach the url "eole.avh.asso.fr/...
0
votes
1answer
33 views

Redirect links to nodes of past events to the up-to-date version

On a event-centered site we have a lot of recurring events, but there's no pattern like every first monday etc. So the editors just clone the event with node-clone and with pathauto we generate a date-...
0
votes
1answer
29 views

Redirect .com domain to .dk/en

I have a site; www.example.net. If you type www.example.com it redirects to www.example.net which is okay. On my site i have to different language prefixes /da and /en that you can switch between. ...
0
votes
0answers
82 views

Redirect to URL with trailing slash using .htaccess

I am trying to redirect url with no trailing slash to the same url with trailing slash by following .htaccess rewrite rules: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f ...
1
vote
1answer
526 views

Getting error 'Redirects to external URLs are not allowed by default'

Getting the error after created this .htacces in root folder. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/web RewriteRule ^(.*)$ /web/ I want to redirect visitors to /web folder. I ...
0
votes
1answer
295 views

Redirect Module doesn't redirect from node/{nid} to alias

I installed the redirect Module in Drupal 8 but sorrily can't get it to work properly. I enabled all checkboxes in the settings, also the "Enforce clean and canonical URLs" option. In my page source,...
0
votes
0answers
22 views

SEO - redirect old urls to node/### paths or node aliases?

We've got an old site that we just finished migrating to D8. We are adding a ton of redirects to the site, but I'm wondering whether it's best to issue these redirects to the new node/### paths or ...