RewriteCond and RewriteMap implimentation- PLEASE HELP!!!

New to mod_rewrite? This is a good place to start.

RewriteCond and RewriteMap implimentation- PLEASE HELP!!!

Postby lerch » Fri Mar 03, 2006 11:04 am

Heres the issue. I want to set up a way for developers to control their redirects through use of a simple map file. RewriteMap seems to fit the bill, so that i can put the map into an area that is accessible by the developers and will be read ever night when they do the reboot of the server. Here is what i have so far:
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....
lerch
 
Posts: 1
Joined: Fri Mar 03, 2006 7:59 am

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 28 guests

cron