htaccess trailing slash + redirect fix?
October 6, 2007 9:35 PM
Subscribe
Is it possible to append trailing slashes AND have a URL redirect using .htaccess?
I'm in the middle of migrating domains (both are on the same server, if it helps) and want to redirect http://www.oldname.com/foo/ to http://foo.newdomain.com. In my .htaccess file, I have the following:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^olddomain\.com/foo
RewriteRule (.*) http://foo.newdomain.com/$1 [R=301,L]
And that works really well. However, olddomain.com/foo/ is usually accessed by dropping that trailing slash and being only olddomain.com/foo. Is there any way to get the URL to write the slash in, then redirect to the new domain?
posted by Hot Like Your 12V Wire to computers & internet (4 comments total)
1 user marked this as a favorite
posted by cerebus19 at 9:49 PM on October 6, 2007