Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite Subfolders

Mod_Rewrite from Subfolder to Root

         

advancedgraphix

2:32 am on Oct 12, 2007 (gmt 0)

10+ Year Member



Hi, I've been using this mod_rewite code, basically to take my city subfolders from the state folder to the root, like this.
domain.com/state/city/ to domain.com/city/

#Add City Mod
RewriteRule ^([^/]+)/$ /State/$1/ [L]

Rule works great, but the problem is that I have to write additional rule for the rest of the pages I have in the city subfolders, like this:

RewriteRule ^([^/]+)/my-page\.htm$ /State/my-page.php?city=$1 [L]

So, now I'm looking to add more content to the city subfolders, is there a better way of setting up the first State Mod so I don't have to write additional rules for every page added?

jdMorgan

11:58 pm on Oct 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've looked at this several times and still can't suss it out. A few example URLs with their corresponding server filepaths would be helpful.

Jim