httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anders Norrbring" <>
Subject [users@httpd] rewrite rule ideas needed..
Date Fri, 09 Jan 2009 11:26:57 GMT
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. should be should be

Thank you for your ideas!

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