Forum Moderators: phranque

Message Too Old, No Replies

Directory 301 redirect but not files

         

Pass the Dutchie

10:13 am on Mar 6, 2010 (gmt 0)

10+ Year Member



So far I am unsuccessfully trying to preserve some inbound links from returning a 403 and would appreciate some help.

Basically, can I return a 301 for a directory without redirecting all the pages within the directory?

jdMorgan

6:02 am on Mar 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, by using a pattern that looks to see if the requested URL-path ends with a slash, or if it has more path-information following that slash.

Jim

Pass the Dutchie

12:57 pm on Mar 8, 2010 (gmt 0)

10+ Year Member



Thanks Jim. I found another way by placing index.php into the directory and redirecting that file.

Cheers

g1smd

7:43 pm on Mar 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That doesn't sound like the best way to do it.

Two lines of .htaccess code will do what you want at the server level, without invoking any disk reads to fetch files first.