[COLUG] Multiple Domains - Apache
Deepan Chakravarthy
codeshepherd at gmail.com
Tue Apr 29 02:45:50 EDT 2008
Duane wrote:
> 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.
>
I added separate virtualhosts for doamina.com, www.domaina.com,
domainb.com, and www.domainb.com. It works fine.
Thanks
> Add serveralias domaina.com to virtualhost 1, and so on and you will
> have more joy.
>
>
--
Deepan
Sudoku Solver http://www.sudoku-solver.net/
More information about the colug432
mailing list