Here are my steps:

  1. Download and install module, enable it in Admin > Modules
  2. In admin/build/path-redirect/edit, enter existing URL alias on site in the FROM field
  3. Enter different existing URL alias on site in TO field, and click SAVE
  4. In admin/build/path-redirect, verified that URL aliases were entered correctly by clicking them
  5. Enter FROM URL in browser address bar, click GO
  6. RESULT: browser went to FROM URL
  7. Expected result: browser is redirected to the TO URL
  8. I'm using Drupal 6.11. This seems to be a pretty straightforward module, therefore my conclusion is that it's not working. I'd be happy to hear otherwise.

    Dale

Comments

MiMe’s picture

I'm having the exact same problem with my installation! It doesn't do anything.

MiMe’s picture

This is Not fixed in the 6.x-1.x-dev version either.

MiMe’s picture

Priority: Normal » Critical

Changing priority to critical since the module does not work!
Btw, I'm using Drupal 6.12

Dave Reid’s picture

Ok I take a look at it. Do both of you have clean URLs enabled/disabled? Do you have language prefixing enabled? Anything to help me debug this?

jjeff’s picture

I noticed that that D6 version is using hook_init() rather than hook_boot(). My understanding is that hook_init() doesn't fire for cached pages. This would cause this type of "nothing is happening" behavior for non-logged-in users on sites with page caching turned on.

MiMe’s picture

Yes, I have clean URLs enabled. I also have Locale installed but I'm not using any prefixes. I have tried clearing the cache and logging out, but this does not help.

Dave Reid’s picture

Using hook_init() should work just fine since Drupal doesn't cache 404 pages. Therefore the code should execute everytime the path is requested.

jjeff’s picture

Using hook_init() should work just fine since Drupal doesn't cache 404 pages. Therefore the code should execute everytime the path is requested.

Interesting, but what if you're redirecting an existing path to something better.. For instance redirecting "/node" to "/my-better-views-listing"...

But perhaps I'm getting off-topic for this thread.

Dave Reid’s picture

Oh, path redirect shouldn't be used for existing paths. I think the from field is actually validated so that you can't use existing paths. In that case path alises and global redirect should be used.

MiMe’s picture

Say what?
What you're saying is that path redirect will never work with any existing paths? This is the whole concept of a redirect.

dalehgeist’s picture

Category: bug » feature

I'm just as surprised as MiMe.

I think I was clear in my initial post that I was attempting a redirect from an existing path. The from field quite happily allows me to enter existing paths - validation against existing paths would be a good idea, but doesn't seem to be happening currently. I changed this bug to a feature request to reflect this.

I just deleted the existing path from the Drupal database (Admin > Site Building > URL Aliases), and indeed, the redirect now works as expected.

MiMe’s picture

Hmm... I cannot get this to work even though I have deleted the existing path.

Lets say that I already have a valid URL alias (since I have saved my node and this creates an alias).
The node is now accessible from both the http://www.example.com/alias and http://www.example.com/node/x which is not good.

Lets enable the path redirect module to fix this... (as I have done on all of my previous websites)

I enable the path redirect module and goto the settings in URL alias, check the "Create a new alias. Redirect from old alias".
Re-save the http://www.example.com/node/x, which re-save the alias and automatically create a 301 redirect from http://www.example.com/node/x to http://www.example.com/alias... but no 301 is being done, both URLs are accessible as if path redirect is doing nothing.

When I go to the URL redirects list I would expect to see a redirect from http://www.example.com/node/x to the http://www.example.com/alias by a 301 permanently moved. But nothing happen... both URLs work.

Well, lets add a redirect directly since it should work to redirect a core node path to an alias created with pathauto, right?
From: node/x
To: alias
Language: All languages

The redirect is listed but does not work. If I instead enter as the To the redirect works, well actually not correct since in this case redirects to the path entered as the standard front page http://www.example.com/frontpage, and not the http://www.example.com as would be expected.

So my guess is that something is still wrong with the module.

apaderno’s picture

What the maintainer said is that already a module that works with existing paths; if this module would do the same thing, then it would be a duplicate, in term of functionality, of the other module.

dalehgeist’s picture

Status: Active » Closed (works as designed)

I originated this bug, and I'm closing it: the behavior of the module is by design. If you redirect from a non-existent path, the module works fine.