On 05/10/2011, at 14:28, Voytek Eymont wrote:
> www.name.com is the web host, so, do I set a www.name.com.au host with
> permanent redirect ? or how ? (I used in the past httpd directive to point
> both hosts at same http/path/to/index.html, though I'm not sure that is a
> good idea ?)

Your hunch is correct — there should be one canonical location for your 
website. All auxiliary domains should redirect to the main one.

I'm assuming Apache? If so, two main ways to do it: use two VirtualHosts + 
Redirect, or use one VirtualHost + mod_rewrite.

Example #1:

NameVirtualHost *
<VirtualHost *>
        ServerName      name.com
        ServerAlias     www.name.com
        DocumentRoot    /var/www/name.com
</VirtualHost>
<VirtualHost *>
        ServerName      name.com.au
        ServerAlias     www.name.com.au
        RedirectPermanent       /       http://name.com/
</VirtualHost>

Example #2:

<VirtualHost *>
        ServerName      name.com
        ServerAlias     www.name.com name.com.au www.name.com.au
        DocumentRoot    /var/www/name.com

        RewriteEngine   On
        RewriteCond     %{HTTP_HOST}    !^name\.com$    [NC]
        RewriteCond     %{HTTP_HOST}    !=""
        RewriteRule     ^/(.*)          http://name.com/$1      [L,R=301]
</VirtualHost>


Attachment: PGP.sig
Description: This is a digitally signed message part

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to