> Actually on second thought, the rewrite rule in the first host 
> should be like this to avoid loop:
>       
>      RewriteEngine On
>      RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [OR]
>      RewriteCond %{HTTP_HOST} !^mydomain\.com
>      RewriteRule     .* http://www.mydomain.com%{REQUEST_URI} [L,R=301]

Per manual excerpted below, the first <VirtualHost> section should only be used 
when the hostname being requested isn't listed
anywhere else in a ServerName or ServerAlias, right?!  So these RewriteCond 
shouldn't be needed!  Right?

I'd use exclusion RewriteCond but since we have other domain names on the 
server like www.MyPersonalWebsite.com and
www.OurOldCompanyName.com etc we'd have to write rule for each domain.  Messy. 

Thanks,

Geoff

"Now when a request arrives, the server will first check if it is using an IP 
address that matches the NameVirtualHost. If it is,
then it will look at each <VirtualHost> section with a matching IP address and 
try to find one where the ServerName or ServerAlias
matches the requested hostname. If it finds one, then it uses the configuration 
for that server. If no matching virtual host is
found, then the first listed virtual host that matches the IP address will be 
used." 

http://httpd.apache.org/docs/current/vhosts/name-based.html



---------------------------------------------------------------------
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-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to