This is interesting... is it better to do it this way that to use virtual servers?
Tharun Kumar Allu wrote:
> It can be achieved without virtual host configuration
>
> In the <directory> for /var/www/html do the following
>
> RewriteEngine On
> #
> RewriteCond $1 !^domaina/
> RewriteCond %{HTTP_HOST} ^(www\.)?domaina\.com
>
> RewriteRule (.*) /domaina/$1 [L]
> #
> RewriteCond $1 !^domainb/
> RewriteCond %{HTTP_HOST} ^(www\.)?domainb\.com
> RewriteRule (.*) /domainb/$1 [L]
> #
>
>
>
> On Mon, Apr 28, 2008 at 7:36 PM, Deepan <
codeshepherd@gmail.com
> <mailto:
codeshepherd@gmail.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 <http://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 <http://www.domainb.com>
> ------------------------------------------------------------------------
# Eric Lucas
#
# "Oh, I have slipped the surly bond of earth
# And danced the skies on laughter-silvered wings...
# -- John Gillespie Magee Jr