- Code: Select all
RewriteEngine on
RewriteMap examplemap txt:/htdocs/www.mycompany.com/rewritemap.txt
RewriteRule ^/([^/]+)/?(.*) /${examplemap:$1}/$1/$2 [R=permanent,L]
with the rewritemap.txt
- Code: Select all
product1 new
prodcuct2 old
which should redirect the uri www.mycompany.com/product1 to www.mycompany.com/new/product1
Here are the challenges:
- directories that are not in the rewritemap.txt are defaulting to a blank which is giving me a double // in the redirect
- the files that are redirecting correctly seem to be going through the rewriterule twice and also getting the double //
I think what is needed is to have a RewriteCond which will read the key from the rewritemap and allow the rewriteRule to only work on the uri's contained in the map.
I new to mod_rewrite and any help in this would be greatly appreciated. I have been working on this for a few days now. PLEASE HELP....