Forum Moderators: phranque

Message Too Old, No Replies

redirecting with no trailing slash

cant figure it out

         

nippi

4:23 am on Aug 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am trying to do a quick for to a site that has a problem with 3 directories getting indexed, without the trailing slash. I just want to do a 301 redirection, but its not working.

am trying this

RewriteEngine on

RewriteCond %{REQUEST_URI} ^/categories/Aviaries
RewriteRule ^/categories/Aviaries$ /categories/Aviaries/ [R=permanent,L]

where am I going wrong?

jdMorgan

2:24 pm on Aug 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If this code is in .htaccess, then remove the leading slash from the RewriteRule pattern. Also, the RewriteCond is utterly redundant, and can be removed entirely.

Note that [R=301] is equivalent to [R=permanent] but it is shorter (i.e. faster to process).

Jim