Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Multiple Domains - Apache
- Date: Tue, 29 Apr 2008 11:02:30 +0900
- From: "Kenneth Burling" <burlingk@example.com>
- Subject: Re: [tlug] Multiple Domains - Apache
- References: <5d4da3b88ceb2ef7d5735c55eed18ba9@localhost.localdomain>
On Tue, Apr 29, 2008 at 8:34 AM, Deepan <codeshepherd@example.com> 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>
Make sure that for every www.domainx.com you create a ServerAlias to domainx.com.
In fact, in practice, domainx.com should be the servername, and www.domainx.com should be the alias.
For instance, right after the line
ServerName www.domaina.com
ServerAlias domaina.com
But as I said, I would reverse the positions. www should be an alias, as it is more specific.
- Follow-Ups:
- Re: [tlug] Multiple Domains - Apache
- From: Curt Sampson
- References:
- [tlug] Multiple Domains - Apache
- From: Deepan
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Bill Gates and the GPL , let the flames begin
- Next by Date: [tlug] Chocolates for Stephen
- Previous by thread: Re: [tlug] Multiple Domains - Apache
- Next by thread: Re: [tlug] Multiple Domains - Apache
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links