Eric on 28 Apr 2008 19:11:07 -0700 |
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> > Options +FollowSymLinks > RewriteEngine On > RewriteCond %{HTTP_HOST} ^domainb\.com$ [NC] > RewriteRule ^(.*)$ http://www.domainb.com$1 > [R=301,L] > </VirtualHost> > > > > > > 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/ > > > ___________________________________________________________________________ > Philadelphia Linux Users Group -- http://www.phillylinux.org > Announcements - > http://lists.phillylinux.org/mailman/listinfo/plug-announce > General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug > > > > > -- > Tharun Kumar Allu > ==================== > ph: 505-353-0412 > > > ------------------------------------------------------------------------ > > ___________________________________________________________________________ > Philadelphia Linux Users Group -- http://www.phillylinux.org > Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce > General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug -- # Eric Lucas # # "Oh, I have slipped the surly bond of earth # And danced the skies on laughter-silvered wings... # -- John Gillespie Magee Jr ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|