httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <>
Subject Re: [users@httpd] Stupid Question: Canonical Name Rewrite Location
Date Thu, 03 May 2007 18:42:07 GMT
On 5/3/07, Ann Hopkins <> wrote:
> Hash: SHA1
> I have a server with multiple hosts names on one IP address. I have
> figured out from all the searches I made that I can do rewrite the
> other hosts names to "correct" the address to "www".
> ServerName
> ServerName
> ServerName
> ServerName
> RewriteEngine on
> RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
> RewriteRule ^/(.*)$1 [L,R]
> My question is all the examples I have seen are within a "Virtual
> Host" directive.  I don't see any problem with making it global as I
> only have one IP address to worry about.
> My stupid question is:
> Why "Virtual Host"?  Is there some sort of security issue with
> having the "RewriteEngine on" in the master file?

If you don't have any virtual hosts, then you can certainly put
RewriteEngine, etc in the main config. I don't know what examples you
are talking about, but it could be placed inside a <VirtualHost> just
because people dealing with multiple hostnames typically already have
some <VirtualHost>s setup.

By the way, you should only have a single ServerName in the main part
of your config.


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