Link to home
Start Free TrialLog in
Avatar of Beans0063
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/index.php

similarly,
http://www.server.com/bananna/slice/peel/index.php maps to /contentb/bananna/slice/peel/index.php
and
http://www.server.com/bananna/index.php  to /contentb/bananna/index.php

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
Avatar of BigRat
BigRat
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of periwinkle
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
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