0

I have a Drupal 8.7 site with a content type for which I have just activated automatic URLs via pathauto.

We have a number of pages using this content type, and all of them worked perfectly when I activated the alias... except for one, which remained stuck as /node/9669.

I investigated this, and it turned out that the content editor who created the page had unticked the 'Generate automatic URL alias' checkbox on this particular page, hence why it didn't pick up the new pathauto alias.

So I thought it would be a simple thing to tick the box and it would work.

I ticked the checkbox and saved the page, but what actually happened is that it now gives me a browser error saying "page isn't redirecting properly" (Firefox) or "too many redirects" (Chrome).

I have tried regenerating the aliases, manually changing the alias, deleting the alias, recreating it... but nothing I do is getting the page back.

My guess is that there's something that's gotten saved in the pathauto database tables for this which is broken, but isn't showing up in the admin panel.

Can anyone please help me understand what's going on under the hood here and fix this alias.

Thank you.

  • Delete any URL redirects associated to this node id. – Kevin Jul 23 at 11:44
  • @Kevin yipes, you actually hit the nail on the head. It was URL Redirects that was causing the problem. I was trying to find the problem in URL Aliases, and it was redirects all along. There was a redirect of /node/9669 redirecting to /node/9669 so of course it was an infinite redirect. So the problem is solved; the page is working again. Thank you very much. Now the question is: how the heck did that redirect get created? Because I'm pretty certain nobody created it manually. – Spudley Jul 23 at 12:00
  • 1
    For sites with the Drupal redirect module (drupal.org/project/redirect) enabled, there is a default config setting for the module to create a redirect anytime the url on the node is edited. This setting can lead to the infinite redirect issue when a user changes an alias and then changes it back, resulting in a circular reference/infinite redirect. – Anson W Han Jul 25 at 1:00
  • @AnsonWHan - thanks for this. Sounds like exactly the problem I got. Maybe you could post it as an answer so I can accept it. Just needed to delete the rogue redirect to fix it. – Spudley Jul 25 at 9:31
2

The redirect issue described here is pretty common for sites where the Redirect module (drupal.org/project/redirect) is enabled. The module has a default config setting that creates a redirect anytime the url on the node is edited (this includes through bulk operations such as a pathauto alias generation process).

This setting can lead to the infinite redirect issue when a user changes an alias and then changes it back, resulting in a circular reference/infinite redirect.

I highly recommend disabling this setting for sites under construction (where urls are in flux) and enabling once deployed to production. You can toggle it at /admin/config/search/redirect/settings (it's the very first setting on the page, shown in the partial screenshot below)

drupal redirect module settings- partial screenshot

For production sites, be wary of changing a url multiple times- check/manage the list of redirects associated with the node on the node edit form as shown below

enter image description here

You can also check/manage redirects from the full list of redirects assigned in Drupal at /admin/config/search/redirect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.