After enabling global redirect and setting it automatically redirect old aliases to the new, change a node's url from (original) to (something else). Then, change the node's url back to (original). Infinite loop warning appears on node access.

Comments

impleri’s picture

Project: Global Redirect » Redirect
Version: 7.x-1.5 » 7.x-1.0-rc1
Status: Active » Needs review
StatusFileSize
new492 bytes

Whoops, put this in the wrong project. Now with a patch.

Status: Needs review » Needs work

The last submitted patch, redirect.patch, failed testing.

douglasmiller’s picture

Status: Needs work » Needs review
StatusFileSize
new432 bytes

Rerolling the above patch against the latest 7.x-1.x HEAD.

deviantintegral’s picture

This patch does fix the issue of showing the dsm() to users. However, you still end up with an extra redirect that matches the path alias. Does it make sense to delete any redirects that match a path alias when updating an entity?

impleri’s picture

I'm not sure I understand your question. What is this extra redirect that you are speaking about? The patch deletes any existing redirects to the actually existing path alias. It seems reasonable to ensure that new nodes are not redirected to old path aliases (e.g. I create a node at /some/path, then update it to be /different/path with auto-redirect coming in to push /some/path to /different/path. Then, I create a new node at /some/path. Either /some/path should go to the new node -- which this patch makes possible -- or /some/path should not be allowed as an alias and its redirect to /different/path remains until I remove it).

douglasmiller’s picture

StatusFileSize
new460 bytes

The previous version of the patch did not take the language into account. This was preventing redirects from being deleted if any language settings were in use.

das-peter’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new461 bytes

#6 works like a charm.
Only nitpicky thing:

@@ -404,6 +404,10 @@ function redirect_path_update(array $path) {
+    // remove existing redirect if it matches the new alias

Code sniffer reports:
407 | ERROR | Inline comments must start with a capital letter
407 | ERROR | Inline comments must end in full-stops, exclamation marks, or question marks

I've adjusted that and say RTBC.

hanoii’s picture

Possibly related to #1796596: Fix and prevent circular redirects, I believe the other one is probably a duplicate of this one, just noting it here for reference.

owen barton’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

#1796596: Fix and prevent circular redirects was here first, and the patch is quite a bit further along (it handles existing aliases, and also includes tests), so marking this one as duplicate.