Questions tagged [redirection]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
8 views

How to programmatically trigger 403 within a drupal hook

In a module within a drupal hook I'd like to conditionally trigger a 403 for the user. I could archieve this e. g. by throwing an exception throw new \Symfony\Component\HttpKernel\Exception\...
c1u31355's user avatar
  • 160
0 votes
0 answers
50 views

Dev redirects to prod on every URL

I've got a dev version of a production site that seems complete and responsive, but when I navigate to that site in my browser it takes me to the prod site. I have grepped every .htaccess file on the ...
Deej's user avatar
  • 41
0 votes
1 answer
38 views

Clearing cache via admin_toolbar results in white screen with "Redirects to external URLs are not allowed by default"

After pressing this admin_tool button to Flush all caches, the browser hangs on a white screen with the message: Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\...
DriveItLikeYouStoleIt's user avatar
0 votes
2 answers
66 views

How to do Do a redirect in buildForm()?

I send a link to a URL by email. This page is created with a controller which contains a form (FormAPI). I pass a token as a parameter to secure access to this form. So I check if this token exists ...
Sébastien Gicquel's user avatar
0 votes
1 answer
103 views

Show message after redirection

This will be mostly a Drupal question rather may not have any relation to Drupal commerce checkout. I have an Offsite Checkout redirect payment method in which I have a buildRedirectFrom as stated in ...
KTM's user avatar
  • 2,352
0 votes
1 answer
73 views

Website doesn't load properly from htdocs/web

Built a website on localhost, moved it to shared-hosting where webroot is htdocs but when visiting the website through the hosting's given IP address it obviously doesn't load the website, because the ...
user3108268's user avatar
-3 votes
2 answers
46 views

Using custom scheme (myapp://dashboard) in drupal simple-oauth2 module's redirect url

How can I use custom scheme i.e. myapp://dashboard for the redirect field of Drupal simple oauth2 module? I get this error: 'myapp://dashboard is not a valid url' I also tried to use the redirect ...
Tejas's user avatar
  • 1
-3 votes
1 answer
59 views

I have deleted Redirect module and have lost alias-to-alias redirects as well as the ability to show aliases in some nodes

I uninstalled and removed the Redirect module using these commands. vendor/bin/drush un redirect composer remove drupal/redirect This caused me to lose about 15 alias-to-alias redirects. I have also ...
alhemist's user avatar
1 vote
0 answers
61 views

Contrib module service overriding not working

I am using the ‘Path Redirect Import module along with the Redirect module. I am trying to override its service ‘path_redirect_import.importer’ To do this, I have added a service provider and a custom ...
Aurora's user avatar
  • 11
0 votes
1 answer
81 views

Is there any danger in uninstalling Redirect module?

Drupal 9.5.3 with no core customizations and very few contrib modules: Redirect Asset Injector Token All nodes in this website have alternative aliases such as example.com/my-first-node instead of ...
somo's user avatar
  • 5
0 votes
0 answers
128 views

Url-aliases or redirect without language prefix

How can I use url-aliases in additional languages without the language prefix? From his old homebrew-CMS, my client has the following URLs: example.com/english-page => redirecting to example.com/...
mullzk's user avatar
  • 65
0 votes
0 answers
54 views

Website URL issue

I have an Drupal 10 installation on my Macbook Air. The web root is ~/Sites/drupal10/web. I have a hosts file entry pointing d10.mf.local to localhost and I have an Apache Vhost set up with ServerName ...
Martin Fuggle's user avatar
-3 votes
1 answer
42 views

Preventing one site from redirecting to www. prefix in multisite [closed]

I am using Drupal 9, multi-site. Generally, for all sites except one, i want to redirect from non-www to www prefix and i'm using the root .htacces file for it by uncommenting redirect rules. But the ...
Tomáš Bažant's user avatar
0 votes
0 answers
51 views

Fetch redirect alias using the old alias

I want to get the current alias of the node using an old alias. I do have the Redirect module installed and all the old aliases of the nodes are mapped to the new ones. But I am not able to fetch the ...
Farhan Erooth's user avatar
0 votes
1 answer
199 views

Stripe doesn't see API key after TrustedRedirectResponse

I have a controller that calls the Stripe API using stripe-php to create a checkout session. /** * Checkout using Stripe. * * @param \Symfony\Component\HttpFoundation\Request $request * ...
mbomb007's user avatar
  • 516
0 votes
1 answer
781 views

How to redirect custom ajax form to external url with headers

When setting the form with ajax handler like this public function buildForm(array $form, FormStateInterface $form_state) { //... $form['actions']['submit'] = array( //... '#ajax'...
Viswa's user avatar
  • 13
0 votes
0 answers
17 views

onNotify called 3 times on error returned

I'm using the OffsetRedirect.php file to handle the return of my bank when the user pay his order. Inside this file, i use the onNotify() method public function onNotify(Request $request) { $...
lobafox's user avatar
  • 103
0 votes
0 answers
51 views

How can we redirect from a node's /latest URL if there is no latest moderation state when the user clicks it?

Drupal 9: We want to link users to the node's "/latest" URL but if there is not currently a latest version then they get an access denied message. We'd like to, instead, redirect the user to ...
quantumized's user avatar
  • 1,177
0 votes
0 answers
60 views

Keep page published or unpublish?

Such a simple question I'm sure, but I can't find anything anywhere on this. I ran lots of tests - if the page is deleted the redirect doesn't work, but whether I unnpublish or keep the page published ...
Chris's user avatar
  • 11
1 vote
1 answer
262 views

How to redirect to a specific page after submitting password reset?

When a logged in user resets their password at /user/password and clicks the submit button, they are being redirected to the frontpage. How can I redirect to /user instead? I've tried the second ...
Problue Solutions's user avatar
1 vote
1 answer
297 views

Redirect user to a custom page after one time login

If my user click to "forgot password", and email with a one-time login is sended. When the user clicks the given link, he's redirected to this page /user/reset/$id with the user_pass_reset ...
lobafox's user avatar
  • 103
2 votes
2 answers
649 views

Redirect doesn't work for .pdf file

Is it possible to create a redirect for documents using the Redirect module? I can't seem to find a solid answer. Basically I'm just trying to create a redirect from https://www.example.com/default/...
divspan's user avatar
  • 21
0 votes
1 answer
120 views

Custom alias for home page

I have a bilingual website (French and English) I have set "/fr/nom-de-page" as the home page in /fr/admin/config/system/site-information But Drupal 9.4.5 insist on redirecting to /fr/ I ...
MastaP's user avatar
  • 152
0 votes
0 answers
71 views

How do I redirect users after login without using contributed modules?

We have to upgrade Drupal 8.9 to Drupal 9.3.3; since the login_destination module stop working, and we don't know why, I've tried others modules like Anonymous Login, Redirect After Login, User ...
Franco Martinez's user avatar
0 votes
1 answer
565 views

Programmatic webform redirect on submission not redirecting

I have a webform with the confirmation set to redirect to URL (redirects to a custom path or URL) In my webform handler, I have the following: public function confirmForm(array &$form, ...
JAyenGreen's user avatar
1 vote
0 answers
228 views

Session/cookie not working for some data on certain conditions

I'm trying to simply redirect to a certain page after is visited. The scenario : the user click on a link. If the user a certain data (a store, for drupal commerce), he can go to my node. If not, ...
lobafox's user avatar
  • 103
0 votes
1 answer
358 views

check if a page has been redirected and then add a class to a certain div

Im using the redirect module to redirect /page/scheduling to /page. I need to check if the user arrived to a certain page by this redirect. by checking this i will then add a class to a certain div. ...
João Mateus's user avatar
-4 votes
1 answer
68 views

Dealing with tens of thousands of 404's when migrating from MediaWiki to Drupal

I have a MediaWiki 1.36.1 website with nearly 2,500 content webpages (generally all of these are either article or Category:) which I consider to migrate to Drupal. Moving each piece of content from ...
Arcticooling's user avatar
1 vote
1 answer
81 views

Is there a way to redirect any 404 to the homepage?

I understand that Drupal doesn't have a core module to handle redirects and that's normally done by the Redirect module, or from the webserver. But if I want to redirect any 404 to the homepage, due ...
Arcticooling's user avatar
0 votes
1 answer
1k views

ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY'

When importing a dump from a production site with mysql in a xampp environment I got this error: ERROR 1062 (23000): Duplicate entry '/-de' for key 'PRIMARY' These lines are affected: ALTER TABLE `...
0711master's user avatar
0 votes
1 answer
195 views

Changing a node alias to reuse his old url programmatically without be still redirected to the node page

I'm on a old site on drupal 7. I have a node with alias /url. Now I need to manage that page url programmatically, so I create an item in a custom module using hook_menu() in this way: /** * ...
robdex's user avatar
  • 11
0 votes
1 answer
691 views

How do redirect a user after login to a route that requires the UID?

I know, this seems like a basic question: In Drupal 9 how do I redirect a user after logging in to a path/route that requires the UID in the path? I've researched and tried different implementations ...
quantumized's user avatar
  • 1,177
0 votes
2 answers
352 views

Redirecting to a route name

I've recently built a module. In the twig template that I render, you can delete an item. For example it goes to /delete/item/1. That works fine. that route triggers a delete method from my controller ...
Jorn Reed's user avatar
0 votes
1 answer
193 views

Anonymous user redirected to core/install.php while admin does not

As an admin I've built a large table on Drupal 8 (php, mysql). It runs without issues for Admin, but trying as Anonymous user it redirects me to core/install.php Since it's ONLY affecting Anonymous ...
Sonya's user avatar
  • 17
0 votes
2 answers
169 views

redirect an old url that no longer exists related to a file to a new one

I have 2 urls: www.example.com/somefile.pdf www.example.com/somefileNew.pdf the first one no longer exists, i want to redirect this url to the new one. I tried to use the redirect module to no avail ...
João Mateus's user avatar
1 vote
1 answer
142 views

Redirect directly to the payment provider page

I'm building a store with Drupal Commerce and creating my own off-site payment gateway. On the review page, after selecting payment method, the user can click the button to pay and finish the order. ...
Mistraë's user avatar
  • 392
-2 votes
1 answer
769 views

How to open a form in modal from controller while redirect

I can open a form in modal when click on a link (and there are lot of examples in the net as well). What I like to do: When some one go to a url in browser or redirect to a url, it will open a dialog/...
Md. Shafiq Hossain's user avatar
0 votes
1 answer
374 views

Pass a value via URL to a node edit form and use it to redirect after saving the node

I have a node that includes a series of embedded views. When displaying, I have to pass a value via URL arguments (http://example.org/node/x?id=y), so that the views can get the appropriate ...
gmak's user avatar
  • 59
0 votes
0 answers
89 views

How do I redirect users from the server IP to the URL with path?

I'm working on a Drupal site. Everything works when I access the site using its IP address. My supervisor made an Nginx redirection on another server to the site's IP. Now the site should be ...
Mattias's user avatar
5 votes
1 answer
374 views

In a hook, how can I distinguish between web users and JSON:API users?

I have a Drupal website that also hosts an Ionic app via JSON:API. I want website users to be redirected on entity insert, so I added a redirect like this: function MYMODULE_flagging_insert(...
Patrick Kenny's user avatar
0 votes
0 answers
51 views

How can we build a view of nodes with their redirect source URLs shown in it?

I want to build a view of nodes with their redirect source URLs along with node titles. However a direct relationship cannot be established as they do not have a common reference.
Binny's user avatar
  • 886
0 votes
0 answers
125 views

How do I force /web in the URL?

I have installed Drupal 8 as multi-site using Composer (as described by kalose). Basically, the folders created as subdomain-folders have been replaced with a symbolic link to the respective sub-...
sigridt's user avatar
  • 69
0 votes
1 answer
209 views

How do I redirect to the login page?

I have a custom search form which appears in the modal and is accessible only to logged in users. The ajax url of the form is /my/custom/search/modal/{nojs}. The router definition is the following one....
Sathya Gopi's user avatar
0 votes
2 answers
849 views

How can I programmatically bulk delete redirect entities based on their status code?

I have a list of 3089 301 redirects URLs and want to delete them programmatically from the database. E.g List of source URLs /about/test/2013/page_61732.html /about/test/additional/branches/page_38678....
Sue's user avatar
  • 35
2 votes
2 answers
1k views

How do I get group to which the node belongs and redirect anonymous users to the login page if they land on it?

I'm using the Drupal Group module and I've added content to a Drupal group I've created. I've also added users to this Group. Works well: Drupal users have to login to see this content in that group. ...
therobyouknow's user avatar
0 votes
0 answers
172 views

Rabbit Hole redirects not working for admin

I have a problem with Rabbit Hole redirects. I've set rabbit hole redirect for a content type, saved it, cleared cache. The problem is that the redirects work only for anonymous users. When I am ...
sailormoon's user avatar
0 votes
1 answer
118 views

Form submission not saved when using a dynamic redirect

I have forms where I use a form alter to set various form fields on the fly. One of which is the Thank You page field that a user should go to after submitting. Example $form['submitted']['...
Stuart Green's user avatar
0 votes
1 answer
527 views

URL Redirects and Configuration Management

I have installed Drupal's Redirect module to redirect from old URL's to new ones. I have added the required redirects in my local environment, ran drush cex but can not see the redirects in the export ...
tnum's user avatar
  • 21
1 vote
1 answer
160 views

How to insert custom redirect script in index.php without losing it on update

At the moment I'm migrating an old site to Drupal. To redirect all old url's to new ones, I made a script that has to be inserted before anything goes off, so in index.php at the top. <?php ...
C.A. Vuyk's user avatar
  • 227
1 vote
1 answer
641 views

How can I redirect user, while showing them a status message?

I'm working on a custom module, in which I want to redirect users, while showing them a status message. What I've tried so far only works for authenticated users but I want to redirect anonymous users....
Kartagis's user avatar
  • 612

1
2 3 4 5
17