Questions tagged [redirection]
Redirection in Drupal means sending the users to a different page.
835
questions
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.
...
0
votes
2
answers
1k
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 ...
3
votes
4
answers
953
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
1
answer
152
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
3
answers
5k
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
2
answers
1k
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
1
answer
249
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
2
answers
105
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
1
answer
86
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
1
answer
423
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
0
answers
46
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
1
answer
252
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
1
answer
153
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
3
answers
59
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
0
answers
27
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
1
answer
37
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
1
answer
214
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
1
answer
1k
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 ...
2
votes
1
answer
135
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
1
answer
624
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
0
answers
184
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
1
answer
84
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
1
answer
37
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.
...
2
votes
1
answer
4k
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 ...
1
vote
1
answer
1k
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
0
answers
32
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
1
answer
3k
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
1
answer
177
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
2
answers
187
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
1
answer
312
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/...
2
votes
1
answer
117
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
1
answer
33
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 ...
1
vote
1
answer
2k
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
1
answer
681
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
3
answers
980
views
Problem creating redirect from page with %20 [closed]
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
1
answer
26
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 ...
5
votes
1
answer
4k
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
1
answer
333
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 ...
0
votes
1
answer
117
views
redirect to prod url when creating content
I have a Drupal 7 development site that is a subdomain of the production site, eg. dev.prod.com, for example.
When ever I create a content type, new content, a new user, install a new module, etc on ...
1
vote
0
answers
471
views
Front page identification and page--front template not working
After install URL Redirect module not able to check the current page is front page or not by programmatically. Following code does not return anything:
\Drupal::service('path.matcher')->isFrontPage()
...
0
votes
1
answer
92
views
Actions module - redirect to url
I'm trying to learn about the functionality of this module, however I don't understand quite right what the Redirect to URL option means/does. Any hint in the right direction will be much appreciated.
0
votes
0
answers
208
views
D8 - Homepage Redirect gets cached
Is there any way to keep the redirect logic of the homepage uncached but to keep the page itself cached?
I have a "location by ip" redirect on the "/". This logic then redirects to the correct ...
0
votes
1
answer
967
views
Redirect users to an external URL
Is it possible to redirect users from a controller?
I tried using the following code, but it doesn't work.
public function hello() {
$query = $db->select('coop.oad','x');
$query->fields('...
1
vote
1
answer
479
views
Creating redirects for files (images) on Pantheon
What is the best way to create 301 redirects on Pantheon for file? I can create redirects for paths by placing rules in my settings.php:
switch ($_SERVER['REQUEST_URI']) {
case '/my-path':
...
0
votes
0
answers
58
views
How to redirect form action to external link after getting form feild value after theming of a external html page
I have enabled a .tpl.php file in theme in drupal 7 which contain a form field. So my requirement is to redirect the from field action to another external link after getting value from that from field....
1
vote
1
answer
429
views
Locked out of the site, and new users can't get in
I have an odd problem. My new Drupal 8 site is a distro, purchased from ThemeForest. After installing it, I thought I created a new user correctly but maybe the name had disallowed characters. In any ...
0
votes
0
answers
99
views
URL alias with multi-lingual site access doesnt work
i have two systems, one live system and a local one, which are almost the same configured.
i have a node which is in english (/testEN) and basic translated in german(/testDE). if i call on my local ...
10
votes
4
answers
17k
views
How to do a RedirectResponse with a destination query parameter?
This works:
$redirectURL = '/cart/add/p2';
return new RedirectResponse(base_path().$redirectURL);
The problem is, I want this:
$redirectURL = '/cart/add/p2?destination=somewhere';
The moment I ...
1
vote
1
answer
249
views
Can't get a Redirect Hook to Fire
I'm attempting to use hook_redirect_alter() as described in redirect.api.php.
I created my_module.module and entered the hook as: function my_module_redirect_alter($redirect) To test I just entered a ...
0
votes
1
answer
698
views
The path alias doesn't work on https
When I visit http://www.example.com/node/439432 on my site, it correctly redirects me to https://www.example.com/myalias.html.
However, When I try to visit https://www.example.com/node/439432, I am ...