[COLUG] Multiple Domains - Apache

Duane duane at e164.org
Tue Apr 29 01:37:25 EDT 2008


Deepan wrote:
> Hi All,
> 	I am serving two domains from the same machine
> using Apache. I want www to be used in both of the
> domains, hence I redirect  urls without www to
> appropriate urls with www. I have the following
> configuration in httpd.conf to achieve this.
>        
> 
> 
> 	NameVirtualHost *:80
> 
> 	<VirtualHost  *:80>
> 	DocumentRoot /var/www/html/domaina/
> 	ServerName www.domaina.com
> 	Options +FollowSymLinks
> 	RewriteEngine On
> 	RewriteCond %{HTTP_HOST} ^domaina\.com$ [NC]
> 	RewriteRule ^(.*)$ http://www.domaina.com$1
> [R=301,L]
> 	</VirtualHost>
> 
> 
> 	<VirtualHost *:80>
> 	DocumentRoot /var/www/html/domainb/
> 	ServerName  www.domainb.com
> 	Options +FollowSymLinks
> 	RewriteEngine On
> 	RewriteCond %{HTTP_HOST} ^domainb\.com$ [NC]
> 	RewriteRule ^(.*)$ http://www.domainb.com$1
> [R=301,L]
> 	</VirtualHost>

your redirect will never work since the request will never match.

Add serveralias domaina.com to virtualhost 1, and so on and you will
have more joy.

-- 

Best regards,
 Duane

http://www.freeauth.org - Enterprise Two Factor Authentication
http://www.nodedb.com - Think globally, network locally
http://www.sydneywireless.com - Telecommunications Freedom
http://e164.org - Global Communication for the 21st Century

"In the long run the pessimist may be proved right,
    but the optimist has a better time on the trip."


More information about the colug432 mailing list