httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob <>
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}]+\$

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]


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message