httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoff Millikan" <gmilli...@t1shopper.com>
Subject RE: [users@httpd] Special configuration for requests that do not match any particular virtual host? Apache 2.2
Date Thu, 02 Jun 2011 00:40:50 GMT
> 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-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