htaccess

Redirect a site to the correct domain name

Suppose you have a domain name set up on a dedicated IP. Anyone else can set an A record in their DNS and they will see your content.

This can lead to “duplicate content” issues with the search engines.

To get around this, you need to set up a .htaccess redirect so forward any requests that are NOT your domain, to your domain

## Stop other domains from using this IP Address
RewriteCond %{HTTP_HOST} !^domain.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1

done

Leave a Reply