4

I have multiple domains pointing at the same website. (FFFF.com, FFFF.ca, FFFF.org, etc)

What's the best way to achieve a rewrite to FFFF.com all incoming traffic?

URL rewrites or 301s? Looking for best practice. These two would be dealt with within htaccess right?

Thanks,

jonasll
  • 493
  • 3
  • 8
  • 20

2 Answers2

2

You would want to do a 301 in this instance. In general, if you're trying to figure out which method is best practice, it's usually the choice that makes it clear to the client what is going on. Transparently re-writing makes it look like three domains have the same content. A 301 politely informs the client that the content resides somewhere else.

menacingly
  • 728
  • 4
  • 11
2

Use this code in your .htaccess:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^(www\.)?FFFF\.com$ [NC]
RewriteRule ^ http://FFFF.com/%{REQUEST_URI} [R=301,L]

This basically 301 redirects all the URIs to FFFF.com if domain name in request is NOT FFFF.com.

anubhava
  • 761,203
  • 64
  • 569
  • 643
  • OK so just so as I understand this, this will not affect let's say blog.FFFF.com if the blog.FFFF.com is CNAMEd at the DNS level right? – jonasll Mar 01 '12 at 18:14
  • No it won't affect that. It just takes domain name from the URL that is entered in browser. – anubhava Mar 01 '12 at 18:17