[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Domain redirect



At 6/20/01 08:31 AM -0700, you wrote:
You will need 2 sections to accomplish this. Something like this should
work:  The second section is the workhorse that will rewrite anything
matching ServerAlias into the exact domain.  This will cause the user's
browser to always display www.realdomain.net regarless of which domain
they entered.  Of course, your apache install must support mod_rewrite
for this to work.

Actually, Jim, I think you have some things mixed up:

* The whole Rewrite thing is separate from Redirect.

* ServerName is one name; ServerAlias are any other names which also result in the same site. Names which are in ServerAlias are *not* rewritten.

* Redirect sends the browser to another site. Rather than "rewriting" the URL, the browser is merely being honest and showing that one page sent him to another. Since it's a different page, of course the URL changes.

   ServerAlias     *real* *fake*

This in particular is not correct. All ServerAlias names are considered real and valid.

Here's some stuff from my httpd.conf file that uses both ServerAlias and Redirect:

<VirtualHost www.domain.com>
     ServerAdmin  webmaster@xxxxxxxxxx
     ServerName   www.domain.com
     ServerAlias  domain.com domain.net domain.org \
                  www.domain.net www.domain.org
     DocumentRoot /home/sites/site001/html
     ErrorLog     /home/sites/site001/logs/error_log
     TransferLog  /home/sites/site001/logs/access_log
</VirtualHost>

#<VirtualHost www.domain.net>
#     ServerName   www.domain.net
#     ServerAlias  domain.net
#     Redirect     permanent / http://www.domain.com
#</VirtualHost>

Note that I use www.domain.com as the ServerName, and then domain.com as the ServerAlias. Also note that there are five aliases for www.domain.com and all work. Domain.net has its own alias, then redirects to the first site. domain.org is dealt with in exactly the same way.


--
Rodolfo J. Paiz
rpaiz@xxxxxxxxxxxxxx