httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] Mod_rewrite - Removing www on dynamic domain names
Date Thu, 10 Jun 2004 22:55:11 GMT

On Thu, 10 Jun 2004, Chris tunnell wrote:

> The webserver I run has multiple domains.  To add
> domains, I create a folder in /var/www/ for the
> domain.
> On the apache side, I run this code so that I don't
> have to create many virtual hosts:
> RewriteMap  lowercase  int:tolower
> RewriteCond  %{REQUEST_URI}  !^/icons/
> RewriteCond  /var/www/${lowercase:%{SERVER_NAME}} -d
> RewriteRule  ^/(.*)$
> /var/www/${lowercase:%{SERVER_NAME}}/$1 [L]
> RewriteCond  %{REQUEST_URI}  !^/icons/
> RewriteRule  ^/(.*)$  /var/www/null/$1
> How do I have it so that when somebody requests
>, this links to /var/www/  I cannot
> figure out how to do this with regex though.  How can
> I do this?
> Removing the "www" is not preferred, but useable.

I'd try something like this:
RewriteCond  %{REQUEST_URI}  !^/icons/
RewriteCond %{SERVER_NAME} ^www\.(.*)$ [NC]
RewriteCond  /var/www/${lowercase:%1} -d
RewriteRule  ^/(.*)$ /var/www/${lowercase:%1}/$1 [L]

Or you could just make symbolic links in the filesystem for the www


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