December 2007
Beginner to intermediate
310 pages
8h 8m
English
You want to translate one URI into another based on the value of the query string.
Put this in your httpd.conf:
RewriteCond "%{QUERY_STRING}" "^user=([^=]*)"
RewriteRule "/people" "http://%1.users.example.com/" [R]mod_rewrite does not consider the query string as part of the URI for matching and rewriting purposes, so you need to treat it separately. The given example translates requests of the form:
| http://example.com/people?user=jones |
| http://jones.users.example.com/ |
The [R] tells mod_rewrite to direct the browser to the
URL constructed by the RewriteRule directive.
Read now
Unlock full access