301 redirect instead of 404 when URL is a prefix of a post or page name?
-
hey all! i have an odd problem with URL routing. i’ve searched the forums, codex, and web, but no luck, so i’m hoping one of you can help!
when i request a URL that doesn’t exist, e.g. https://localhost/foo, wordpress correctly returns a 404. however, if that URL is a prefix of a post or page name, it instead returns a 301 redirect to the post or page.
for example, if i have a post on 10/1/2010 named Food Post, it will return a 301 with Location: https://localhost/2010-10-01_food_post (my permalink structure). likewise, if i have a page named Food Page, it will return a 301 with Location: https://localhost/food_page.
you can see this in action on my live site, https://snarfed.org/ . e.g. https://snarfed.org/foo redirects to https://snarfed.org/2009-10-30_food_highlights .
i see this on two different installations, both wordpress 3.0.1 and apache 2.2, one ubuntu lucid/mysql 5.1 and one freebsd 7.3/mysql 5.0. i’ve deactivated all plugins and removed everything from my .htaccess except the lines for wordpress below, verbatim, but no luck.
RewriteEngine On
RewriteBase /
RewriteRule ^wordpress/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
any ideas? thanks in advance…
- The topic ‘301 redirect instead of 404 when URL is a prefix of a post or page name?’ is closed to new replies.