Beans0063
asked on
mod_rewrite - how to create a rule based on first letter of a directory?
Hello,
I am a mod_rewrite newbie. Can someone help me create a rule, perhaps using a map, to change urls based upon the first letter of the first directory after the server root?
For example,
http://www.server.com/apple/index.html gets mapped to /contenta/apple/index.html
and
http://www.server.com/apple/slice/index.php is mapped to /contenta/apple/slice/inde x.php
similarly,
http://www.server.com/bananna/slice/peel/index.php maps to /contentb/bananna/slice/pe el/index.p hp
and
http://www.server.com/bananna/index.php to /contentb/bananna/index.ph p
I hope that is clear ... files off the root such as http://www.site.com/index.html would also get their own mapping to /content_index or something like that.
Thank you for the help!
I am a mod_rewrite newbie. Can someone help me create a rule, perhaps using a map, to change urls based upon the first letter of the first directory after the server root?
For example,
http://www.server.com/apple/index.html gets mapped to /contenta/apple/index.html
and
http://www.server.com/apple/slice/index.php is mapped to /contenta/apple/slice/inde
similarly,
http://www.server.com/bananna/slice/peel/index.php maps to /contentb/bananna/slice/pe
and
http://www.server.com/bananna/index.php to /contentb/bananna/index.ph
I hope that is clear ... files off the root such as http://www.site.com/index.html would also get their own mapping to /content_index or something like that.
Thank you for the help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will leave the following recommendation for this question in the Cleanup topic area:
ACCEPT: BigRat
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Periwinkle
EE Cleanup Volunteer