[CentOS] www.mydomain.org and mydomain.org should resolve to the same IP

Sun Jul 31 16:45:40 UTC 2011
Les Mikesell <lesmikesell at gmail.com>

On 7/31/11 8:28 AM, Always Learning wrote:
>
>> Because once people link to the site or bookmark it using all four domains
>> you essentially have to maintain all four domains for the rest of the live
>> of the site i.e. through redesigns, restructurings, moves, etc.
>
> Please kindly excuse any misunderstanding I may appear to exhibit.
>
> My Point Number 1: ONE web site.
>
> My Point Number 2: 4 different web site addresses go automatically to
> the ONE web site.
>
> My Point Number 3: no redirection just straight to the single web site.
>
> My Point Number 4: This works well for me in Apache 2.
>
>
> Thus the only maintenance is:-
>
> (5) one web site.
>
> (6) 4 DNS A records pointing to the same IP address
>
>> The better approach is to declare one domain as canonical and redirect all
>> other domains to it.
>
> I simply use 'A' records pointing to the same IP address.

There are several situations that make this not work as well as redirecting to a 
canonical name.  Any external caches (like a squid on the client site) will keep 
separate copies for each name accessed through it.  If the client authenticates 
and then is redirected to one of the other names (and there are likely scenarios 
for that if your site has/needs any absolute references to itself) the user will 
have to authenticate again when the site name changes. Likewise, cookies are 
connected to the name and sessions may act strangely if you jump to a different 
name even though it is the same server.

> In the 10 years I have seriously hosted several personal web sites, I
> have neither cared about Google ratings not sought to enhance the
> position in search engine listings. However, much to my surprise, I am
> top of the Google listing for some searches and within the top 5 for
> others.

You only care about that if you are selling ads directly or want the additional 
traffic that a top rating will get.

It is fairly simple to do the redirects - just have the default virtual server 
in your apache config use a stack of rewriterule based redirects using regexps 
to match the possible host names they might have used and redirect to the 
correct target.  This also makes it easy to move individual sites off to 
different servers when they outgrow a single host or a different set of people 
needs to manage it.

-- 
    Les Mikesell
     lesmikesell at gmail.com