Drupal - Path alias creates redirect loop or redirects to the front page

Edit your page and go to URL redirects. Find the redirect path with the most number of count and delete it. Click save then view the page.

Let me know if that fixed your problem


Update: Drupal issue #1796596 was committed as of Redirect 1.0-rc2 (June 2015). The correct solution for this problem now is to upgrade to the latest stable release of Redirect module, and then run database updates. Any circular redirects you have will be safely cleaned up.

This issue came about due to a bug in the redirect module. You trigger it by changing a page's URL (or maybe just its title, if you're using pathauto) and then changing it back to what it used to be.

For example, let's say I had a page called "company" and I changed the title to "Our company" (which changed the URL alias to our-company). Then I decided I actually preferred it the first way soI edit the node again and change the title back to "Company". At that point the error message "Oops, looks like this request tried to create an infinite loop. We do not allow such things here. We are a professional website!" would start showing up on the Company page.

There are three ways to fix this, depending on what's easiest for you. They range in difficulty/bravery from top to bottom.

The Drupal/PHP method

There's a long Drupal bug on the subject: Issue #1796596 and there is a good working patch that fixes the issue in comment #124.

Hopefully this fix will soon get committed into the Redirect module up for download. However it's been over a year now with no sign of any progress on that front.

The SQL method

The fastest fix for the problem is with a SQL query to the database, with something like below. BE CAREFUL and only try this method if you know what you're doing - try it on a development copy of the site first and make sure you have a backup and test the changes right afterwards in case you need to roll back. Be extra careful and test the first query extra well if you are using i18n... Run the first query to show what would be deleted and the second to actually do the delete.

--Show records to be deleted:
SELECT r.rid, r.language, r.source, r.redirect
  FROM redirect r INNER JOIN url_alias u ON r.source = u.alias
         AND r.redirect = u.source AND r.language = u.language;

--Delete redirects shown in above query:    
DELETE r FROM redirect r INNER JOIN url_alias u ON r.source = u.alias
         AND r.redirect = u.source AND r.language = u.language;

If you do not know how to apply patches or run SQL queries, then you need to fix the problem manually. Don't worry, this is actually quite easy to do (but time consuming compared to the other methods):

The Manual Method:

For each of the pages where the warning message displayed:

  1. Edit the page
  2. Scroll to the bottom of the edit form
  3. Note the main URL of the page. It's shown underneath "URL path settings", e.g. "Alias: company" would mean the URL of the page is "company". You can click on the "URL Path Settings" to visit its section and confirm the URL alias if you're not sure.
  4. Now click "URL redirects". The redirects to the current page will be shown. There will be at least one redirect that is the same as the URL alias you noted in step 3. It's possible more than one redirect in this list will match the URL alias.
  5. Delete all redirects that are the same as the URL alias. These are the problem data that are causing the loop and the error message to be displayed.
  6. Once there are no more redirects under "URL redirects" that exactly match the problem page's URL alias under URL path settings, the error message will be gone.