Host name redirect?

alex at crackpot.org alex at crackpot.org
Tue Jun 26 13:12:56 MST 2007


Quoting Alan Dayley <alandd at consultpros.com>:

> Scenario:
> (Names have been changed to protect the innocent, assuming there are any.)
>
> Old server hostname: duck
> Old server IP address: 192.168.1.3
> New server hostname: eagle
> New server IP address: 192.168.1.9
>
> Old document URL (via http): duck/some/important/document.html
> New document actual URL (via http): eagle/some/important/document.html
>
> After the new server is in place any user or link that requests the old
> URL, "duck/..." needs to be automatically redirected to "eagle/..."
> What do we change to accomplish this?

Add the following to duck's Apache configuration :

   Redirect / http://eagle/

Alternately, you could serve both hostnames from the same box, and set  
up 2 VirtualHosts (1 for each hostname), using the same DocumentRoot  
for each.  Then all content would be availble via either name.

NameVirtualHost *:80
<VirtualHost *:80>
   ServerName duck
   DocumentRoot /var/www/content
</VirtualHost>
<VirtualHost *:80>
   ServerName eagle
   DocumentRoot /var/www/content
</VirtualHost>

That might not work so well for some CMS systems, which want you to  
enter a hostname in a config file for certain URL-writing operations.   
I've also heard that serving the same content via multiple domains can  
hurt search-engine rankings.  But, it'd save you from having to keep 2  
boxes up.

And... I'm sure there are many other ways to accomplish your goals if  
either of these 2 ideas have problems.

alex


More information about the PLUG-discuss mailing list