Re: [SLUG] Multiple Domains - Apache

2008-04-28 Thread Dean Hamstead

you need the ServerAlias directive

Dean

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


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]




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]






However all requests to http://domainb.com/ gets
redirected to http://www.domaina.com  whereas the
expected behaviour is to get redirected to
http://www.domainb.com/ . 
Regards 
Deepan 


Photographic Memory Game:
http://www.photographicmemorygame.com/
Sudoku Solver: http://www.sudoku-solver.net/ 





--
http://fragfest.com.au
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Multiple Domains - Apache

2008-04-28 Thread Sonia Hamilton
On Tue, 2008-04-29 at 05:05 +0530, 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.

Setting up aliases in your dns is probably the way to do this:

ie domaina.com is an alias for www.domaina.com.

-- 
Thanks,
.
Sonia Hamilton
http://www.snowfrog.net
http://training.snowfrog.net
http://www.linkedin.com/in/soniahamilton
.
Your manuscript is both good and original; but the part that is good is
not original and the part that is original is not good - Samuel Johnson.

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Multiple Domains - Apache

2008-04-28 Thread Peter Chubb
> "Deepan" == Deepan  <[EMAIL PROTECTED]> writes:

Deepan> Hi All, I am serving two domains from the same machine using
Deepan> Apache. I want www to be used in both of the domains, hence I
Deepan> redirect urls without www to appropriate urls with www. I have
Deepan> the following configuration in httpd.conf to achieve this.
   


Deepan> NameVirtualHost *:80

Deepan>  DocumentRoot /var/www/html/domaina/
Deepan> ServerName www.domaina.com 

Suggest you add 
ServerAlias *.domaina.com
ServerAlias domaina.com
and likewise for domainb.com


Otherwise, any unrecognised name will go to the default (first)
config.

--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au   ERTOS within National ICT Australia
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Multiple Domains - Apache

2008-04-28 Thread Deepan
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


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]




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]






However all requests to http://domainb.com/ gets
redirected to http://www.domaina.com  whereas the
expected behaviour is to get redirected to
http://www.domainb.com/ . 
Regards 
Deepan 

Photographic Memory Game:
http://www.photographicmemorygame.com/
Sudoku Solver: http://www.sudoku-solver.net/ 


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Multiple Domains - Apache

2008-04-28 Thread Deepan
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


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]




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]






However all requests to http://domainb.com/ gets
redirected to http://www.domaina.com  whereas the
expected behaviour is to get redirected to
http://www.domainb.com/ . 
Regards 
Deepan 

Photographic Memory Game:
http://www.photographicmemorygame.com/
Sudoku Solver: http://www.sudoku-solver.net/ 


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html