Sometimes you need to redirect an ip address to a domain for SEO purposes or for many other reasons, for example an account with a dedicated ip to the domain name. This can be performed easily using mod_rewrite.

For example if your ip is 10.10.10.10, accessing to http://10.10.10.10 will redirect you to http://yourdomain.com

Simply add the following lines in the .htaccess file in your public_html directory changing the domain and the ip number with your information:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^10\.10\.10\.10
RewriteRule (.*) http://yourdomain.com/$1 [R=301,L]

Using this rule if http://10.10.10.10 is accessed then a 301 redirect is created to point to http://yourdomain.com

Was this answer helpful? 5 Users Found This Useful (1067 Votes)

Powered by WHMCompleteSolution