How do I redriect a CPanel IP address to a domain?
Question
I've got a duplicate content issue where there's two instances of my site indexed in google:
the first is the actual domain: http://domain.com
the seconds is my WHM/CPanel preview of the account: http://123.456.78.9/~/domain
Is there any way to redirect the IP version to the real domain?
Solution
Try this
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^123.456.78.9$ [NC]
RewriteRule (.*) http://domain.com/$1 [R=301,L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow