Page Not Found error (trailing slash issue)
ijilagan - May 5, 2008 - 20:56
| Project: | Path Redirect |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I was having trouble with the path redirect module giving me Page Not Found errors on all the redirects. I uninstalled it and replaced it with a fresh install, but my redirects still come up with the same error.

#1
Hi there, ijilagan. Can you post some samples? I'm curious what your "to" and "from" values are, as well as what actually ends up in the browser's URL bar when you test the redirects. It might also help to know what server software you're using; we've seen some issues with IIS that are not yet resolved.
#2
One example I've got is
From: column-archives
To: columns
When I click test, it goes to column-archives with the page not found error. I'm not sure what info you need about server software, but I'm on a linux server.
#3
hi,
could you list the iis issues please? i'm currently running v1.1 and it has been working okay with iis6.
the "page not found" problem occurred when i upgraded to the v1.2, across all kinds of redirects: internal paths and external web sites which had been working before. i did the patch 4 datebasse update twice as the install instructions recommended for an upgrade. fortunately i was able to roll back to 1.1
our setup:
windows 2003 standard
iis6
php 5.2.4 running in isapi mode, with 64mb allocated to run php scripting.
clean urls enabled using the ionic iirf rewriter 1.2.13
thanks.
#4
hey ljilagin,
thanks for bringing this up. i'm having a similar issue.
after upgrading to path-redirect 5.x-1.2 many of my old redirects don't work and i can't add any new ones.
/carpintero
#5
I cannot get path redirect to work either. I just installed ver 1.2 and set pathauto to generate new aliases and redirect from the old ones. Then I started resaving the content and it posts a message after this saying the old url now redirects to the new one. But it doesn't work. I get a "Page not found" when entering the old url.
An example would be
from: http://www.mysnowparks.com/resort/branäs
to: http://www.mysnowparks.com/resort/branaes
My server is running Linux, Apache version 2.2.8 (Unix), MySQL version 5.0.51a-community-log, PHP version 5.2.6
#6
We've also experienced intermittent failure of the redirects. My guess is that it involves cached content somehow, since hook_init() isn't called on cached pages. For now I've disabled caching to see if this fixes it. I'll also play around with hook_boot to see if this fixes it.
I've also confirmed that trailing slashes cause failure.
For example,
my/redirect/path
will correctly redirect if I have that defined, but
my/redirect/path/
won't redirect, even though Drupal considers these the same.
#7
I've determined that due to this module not using a normalized drupal path (trimmed of the trailing slash) in combination with normal caching enabled, can cause paths that should be redirected to instead result in a page not found error.
The attached patch adds an additional check against a normalized path. The patch needs work in that it is yet a 3rd query that must be run on every page load, so some optimization and integration with the first 2 queries is needed.
#8
I'm now using this patch on several different sites, and it appears to have resolved the page not found issue for trailing slashes (or lack there of). Also, changing the title.
#9
I actually applied the patch to Path redirect 6.x-1.x-dev (2008-May-31) and it seems to work fine. I assume the final solution will be worked into the 6 branch, too, right?
#10
Still no solution to this?
I am unable to get my redirects to work. The list on admin/build/path-redirect shows redirects that doesn't work.
Can this have something to do with having global redirect enabled or what is happening?
#11
The patch in #7 also solved the issue for me.
#12
I have committed a fix using the following code before the redirect is looked up in the database. This should save us from having to execute an extra query on each page request. This should fix this issue.
<?php// Remove trailing slash from path.
$path = preg_replace('/\/\?|\/$/', '', $path);
?>
Please test out the 6.x-1.x version (should be rebuilding soon) and see if it works for you. Thanks!
#13
Works for me. Thanks!
#14
Good to know! Thanks for reporting back here!
#15
Automatically closed -- issue fixed for 2 weeks with no activity.