httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob <bobsie...@googlemail.com>
Subject Re: [users@httpd] mod_rewrite subdomains and subdirectories
Date Sat, 06 Jan 2007 18:37:04 GMT
Charles Palmer wrote:
> RewriteCond %{HTTP_HOST} ^[^\.w{3}]+\.wl.example.com$

That won't work. Your expression [^\.w{3}] is invalid. This is a 
character class stating that the chars }3w.{ must not be present. You're 
looking for a negative lookahead, (?!www)

Do you have access to your httpd.conf? If yes, you should place the 
rewrite rules there (per-server context):

# don't mark the end of string with $ here, a port might follow
RewriteCond %{HTTP_HOST} ^((?!www)[a-z]+)\.wl\.example\.com
RewriteRule ^/$ /%1/ [PT]

or this example, which would be more precise,

RewriteCond %{HTTP_HOST} ^([a-z]+)\.wl\.example\.com
RewriteCond %1 !=www
RewriteRule ^/$ /%1/ [PT]

-- 
Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message