httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anders Norrbring" <li...@norrbring.se>
Subject [users@httpd] rewrite rule ideas needed..
Date Fri, 09 Jan 2009 11:26:57 GMT
Hi.
I'm looking at a setup with 6 different ServerAlias in the same single
VirtualHost, and I want a rewrite rule that can rewrite calls missing the
'www' part to add that.

Looking at example pages I see that this works for a single host name:

    RewriteEngine On
    RewriteCond %{HTTP_HOST}   !^www\.domain\.tld [NC]
    RewriteCond %{HTTP_HOST}   !^$
    RewriteRule ^/(.*)         http://www.domain.tld/$1 [L,R]

But how can I create a setup that will simple add www to any of the valid
ServerAlias names listed in the virtual host?  They shall keep the domain
name part as is, and not rewrite to one name only.

Eg.
server1.com should be www.server1.com
sdom.org should be www.sdom.org
etc...

Thank you for your ideas!
Anders.



---------------------------------------------------------------------
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