The path_alias_xt module dynamically expands aliases such as 'project/myproject' for 'node/7' to also include aliases such as 'project/myproject/edit' for 'node/7/edit'. This causes a redirect loop with globalredirect, because the later module is overzealous in its redirection in some instances.

Without path_alias_xt, globalredirect will take a request for 'node/7/edit' and attempt to redirect again to 'node/7/edit'. Because the new path is the same as the old path, this behavior is innocuous. As soon as path_alias_xt is involved, though, the behavior becomes undesirable, because the request is now actually for 'project/myproject/edit'. Now, when globalredirect tries to go to 'node/7/edit', the paths are different, and to 'goto' will take effect. Unfortunately, the next time around, globalredirect will try to do the same exact thing again. This is because, although the current path did change to 'node/7/edit', the request is still for 'project/myproject/edit', so globalredirect will once again try to go to 'node/7/edit', even though that is already the current path.

The solution is to make the conditional around the redirection more rigorous, so that globalredirect will not attempt to redirect from the current path to the same current path. This additional condition does not interfere with the primary operation of globalredirect -- i.e., to redirect from 'node/7' to 'project/myproject' -- because in this case the current path does not match with the desired redirect destination.

Patches for Drupal 7 and Drupal 6 versions of globalredirect attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greg.1.anderson’s picture

For what it is worth, subpath_alias works fine with globalredirect even without the above patches.

Status: Needs review » Needs work

The last submitted patch, globalredirect-6.x-with-path_alias_xt.patch, failed testing.

greg.1.anderson’s picture

Is there any interest in this issue? Please comment or close.

R0land’s picture

I also have this issue. In previous 7.x-1.x-dev version all was fine.

rjbrown99’s picture

I'm interested, and I use both modules, but I have not noticed this problem with path_alias_xt with Drupal 6.

wizonesolutions’s picture

The patch should pass the tests first. I'm monitoring; can commit it when it does if it's otherwise OK.

greg.1.anderson’s picture

I checked my projects, and I have switched to using subpath_alias everywhere. Someone else will need to drive this to completion if path_alias_xt support is desired.

wizonesolutions’s picture

Status: Needs work » Postponed (maintainer needs more info)

Postponing then. I use subpath_alias as well.

bluephx’s picture

Status: Postponed (maintainer needs more info) » Needs review
TravisJohnston’s picture

Subpath is not made for D7, so this is still an issue for us. The Extended Path Alias module works great by itself, and even after GR is enabled. But GR will only work when EPA is turned off.

greg.1.anderson’s picture

The D7 version of subpath_alias is subpathauto.

carajito’s picture

Last devel version of this module and the las version of sub-pathauto

When I try to go user/user-name/edit I will receive access deny

Chris Matthews’s picture

Status: Needs review » Closed (outdated)

Greg's 7 year old patch to globalredirect.module does not apply to the latest globalredirect 7.x-1.x-dev, but this issue should be closed as outdated anyway.

Checking patch globalredirect.module...
error: while searching for:

  // Compare the request to the alias. This also works as a 'deslashing'
  // agent. If we have a language prefix then prefix the alias
  if ($request_path != $prefix . $alias) {
    // If it's not just a slash or user has deslash on, redirect
    if (str_replace($prefix . $alias, '', $request_path) != '/' || $settings['deslash']) {
      globalredirect_goto($alias, $options);

error: patch failed: globalredirect.module:214
error: globalredirect.module: patch does not apply