Forum Moderators: phranque
I currently have htaccess setup to add trailing slashes onto directories:
test becomes test/
However, I am trying to 301 some non-existent pages that are still in SE cache. For example:
board/6040.php does no longer exist on our site, so I can't use the !-d check for the rewrite. So when I try to redirect, I end up with a 404 of board/6040.php/
Any suggestions on how to remove that slash?
Thanks
RewriteEngine on
# Use PHP5 as default
AddHandler application/x-httpd-php5 .php
errordocument 404 /error.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://example.com/$1/ [L,R=301]
[edited by: jdMorgan at 5:12 pm (utc) on June 18, 2009]
[edit reason] example.com [/edit]
I currently have htaccess setup to add trailing slashes onto directories:test becomes test/
Doesn't Apache do this automagically, even without .htaccess in place?
On my webservers, requesting http://www.example.com/directory gets you a 301 redirect to http://www.example.com/directory/ (assuming 'directory' actually exists...)
No need for htaccess or mod_rewrite at all (?)