View Full Version : mod_rewrite

02-17-2007, 05:20 PM
ok so i moved my site from windows server to linux, but some remote sites link to /directoryname/subdirectory/file.html and some link to /DirectoryName/subdirectory/file.html and i need to have a mod_rewrite condition that will redirect all /directoryname/..... to /DirectoryName/.... and some links have multiple subdirectories and some dont. i cant seem to get it to work.

RewriteEngine on
RewriteRule ^directoryname$ DirectoryName$

02-17-2007, 07:44 PM
I'm not an expert but try this:

RewriteRule ^directoryname(/.*)?$ DirectoryName$1$

You were losing the stuff that came after the directoryname, this should keep it for you.