This is a discussion on RewriteRule question within the Apache Web Server forums, part of the Web Server and Related Forums category; I've got a bunch of directories like http://www.example.com/mem_AAA/mem_AAA.htm, where AAA is a member'...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've got a bunch of directories like
http://www.example.com/mem_AAA/mem_AAA.htm, where AAA is a member's initials. I'm trying to redirect all traffic to these directories to their new location: http://www.example.com/members/mem_AAA/mem_AAA.htm So I've tried countless combinations of RewriteCond and RewriteRule, and none work. Here's the latest: RewriteEngine On RewriteCond %{HTTP_HOST} \.example\.com RewriteRule /mem_(.*)/mem_(.*).htm /members/mem_$1/mem_$2.htm [R=301,L] Any ideas? |
|
|||
|
dave_nul@hotmail.com wrote: > I also tried the following, but no luck: > > RewriteCond %{HTTP_HOST} ^www\.example\.com$ > RewriteRule ^/mem_(.*)/mem_(.*) ] Not sure, but maybe because you did'nt specify the end of the rule ? Anyway, i'm not able to test this here, but the following should work: RewriteRule ^mem_[a-z]/mem_[a-z]\.htm$ members/mem_$1/mem_$2\.htm [R=301,L] should work AFAIK ... If initals are always 3 characters you could replace [a-z] with [a-z]{3} or [a-z]{1,3} to have a variable length between 1 and 3. Be sure to escape the dot in your file extension. Frizzle. |
| Thread Tools | |
| Display Modes | |
|
|