views:

126

answers:

2

If I have two domain names:

altcognito.com

and say I've got the other following domain:

alt-cognito.com

What's the "best" redirect (do I use permanent etc...?) I want to suggest that altcognito.com is the "correct" website.

(naturally, these are just examples)

+6  A: 

If you want to say that "you should always go to foo instead of bar," you want a 301 redirect (which you do with your front-end server). See http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=93633

A 302 (temporary) redirect should be used in cases where you can't serve a page, but expect it to come back later. Unfortunately, it's the redirect that you get from JSP forward.

A client-side (meta refresh or javascript) redirect should be avoided whenever possible.

Edit per comment: here's a link to the Apache docs for configuring a permanent (or temporary) redirect: http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect

kdgregory
+1 maybe explain how to set that up in detail
Andomar
+4  A: 
<VirtualHost *:80>
    ServerAlias altcognito.com
    ServerAlias alt-cognito.com
    ServerAlias www.alt-cognito.com
    RedirectMatch permanent ^/(.*) http://www.altcognito.com/$1
</VirtualHost>

The 3 domains (www and non-www) will 301 redirect to your main domain www.altcognito.com

cherouvim