Help with apache mod_rewrite

Bryan O'Neal BONeal at cornerstonehome.com
Wed Aug 20 00:45:48 MST 2008


For reasons I don't want to go into, I need to rewrite all references to
/dir1/dir2/ to /other_dir/ so that /dir1/dir2/file.ext goes to
/other_dir/file.ext and /dir1/dir2/dir3/file.ext goes to
/other_dir/dir3/file.ext and dir1/dir2/dir3/dir4/file.ext goes to
/other_dir/dir3/dir4/file.ext, etc.
 
I can rewrite /dir1/dir2/file.ext to /other_dir/file.ext no problem with
RewriteRule ^/dir1/dir2/(.*) /other_dir/$1 however I can not seem to get
it to preserve directories.  I do not mind writing additional rules to
escape the directories like RewriteRule ^/test/([^/\.]+)/(.*)
/other_dir/$1/$2 but that does not seem to work.  Any suggestions?


More information about the PLUG-discuss mailing list