Stack Exchange Network

Stack Exchange network consists of 174 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

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

0
votes
1answer
20 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
0answers
39 views

How to redirect double slash in url “//” to 301

I'm a newbie in Drupal 8, Somehow, in my website, there is redirection due to double ‘/’ in the URLs, an example from http://example.com//article/slug redirect 302 to http://example.com/article/...
0
votes
1answer
21 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
47 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
votes
0answers
23 views

How to sense what the incoming url is

I wanted to know if there's a way to "sense" the incoming urls? I have a main website and within that main website, there's a sub-website. Basically, there are 3 urls involved. www.main.com www.main....
1
vote
1answer
54 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
45 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 ...
1
vote
3answers
252 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
39 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
2answers
107 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
53 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
24 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 ...
0
votes
0answers
26 views

Redirect based on client IP

I'm implementing SSO with Simple Saml PHP Auth. It works great but UX has mandated that internal users should not have to click anything to login. How can I forward users on our intranet to our saml ...
0
votes
0answers
41 views

HTTP port number lost in URL after CRUD

After any administrative operation the http port is lost when redirect. For example if I'm using the port 3000 when working with Browsersync and update a content the port number disappear. localhost:...
2
votes
2answers
52 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
0answers
26 views

admin/config/system/site-information goes to not found page

It seems that every menu item under admin/config/system is not accessible. Every other admin item seems to work fine. I also tried ?q=admin/config/system/site-information but still get a 404 page. It ...
0
votes
1answer
30 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
30 views

Redirecting Anonymous Users

I've tried using the redirect anonymous code at https://gist.github.com/jorislucius/8c524fb45e8a25657d474c0abe9ef48f which as near as I can tell, is no newer than mid-2017. If there's a date on when ...
0
votes
0answers
52 views

Role specific redirect

I have a page with an overview of magazines. When a member clicks on it, it opens a pdf so they can read the magazine. I'm looking to make it role specific, so when an anonymous user tries to click it,...
0
votes
0answers
23 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
53 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
25 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
38 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
59 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
38 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
19 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
14 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
24 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
209 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
54 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
84 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
61 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
25 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
25 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
54 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 ...
0
votes
1answer
280 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
128 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
18 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 ...
1
vote
1answer
557 views

How to redirect custom ajax form to external url

When setting the form with ajax handler like this public function buildForm(array $form, FormStateInterface $form_state) { //... $form['actions']['submit'] = array( //... '#...
0
votes
1answer
41 views

redirect to custom page

In my custom module, I created a custom link using function MYMODULE_menu() { $items['addcontent'] = array( 'title' => 'Confirmation page', 'page callback' => '...
-1
votes
2answers
69 views

Restricting a part of a site according to IP

This question is closely related with GDPR, and having done my research I've come across this module which seems to offer a checklist type functionality for overall GDPR compliance. However as part ...
0
votes
1answer
30 views

Drupal 8 status code set 301 instead of 302 for urls with out lang code

I have an article with url alias '/gettting-started' and it is translated in several languages. Lang codes for other languages is set like the following. For German:de-de, English: en-us. In 'admin/...
3
votes
1answer
80 views

Why is my form only redirected sometimes?

I want to have a user register, and be redirected to a node create form. Here's how I'm doing it thus far. The setup I have a route, my_module.register that is handled by MyController::register(). ...
0
votes
1answer
31 views

Adding RewriteCode in https does not work for links other than base url [closed]

RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\.example\.com* RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] With this I swap from http:// to https://www in one single redirect ...
0
votes
1answer
386 views

Drupal 8 Form Redirect On Failed Validation [closed]

I have a form which, upon failed validation, should query a custom/non-Drupal table, and if that query is successful, to redirect the user to a custom page that is only accessible through a logged-in ...
1
vote
1answer
211 views

Alternative to RedirectResponse

I have a module that returns a redirect response in hook_node_insert(). $url = 'announcements'; $response = new Symfony\Component\HttpFoundation\RedirectResponse(\Drupal::url($url, [], ['absolute' =&...
0
votes
2answers
109 views

Problem creating redirect from page with %20

I've been researching the issue for hours and can't seem to find a working solution to this problem. I've created a redirect from /sites/default/files/OLB%20Registration%20Guide.pdf to /sites/default/...
0
votes
1answer
20 views

Redirect not obeying front page URL

We are using this module for our redirection for 404's and manually created redirects. The site has a number of pages translated for the American audience. We added a redirect today for a page and ...
2
votes
1answer
401 views

EventSubscriber endless redirect

I have Drupal 8.5.1 and I am trying to force a redirect for anonymous users to the CAS login page. First I thought that the issue was related with the firing of the checkAuthStatus function below, ...
0
votes
1answer
42 views

Error when running database update: “DatabaseSchemaObjectExistsException: Cannot add field redirect.status: field already exists.”

I'm getting the following error when attempting to run a database update: Update #7101 Failed: DatabaseSchemaObjectExistsException: Cannot add field redirect.status: field already exists. in ...