12 May 2018

Prevent other domain to point to your dedicated IP – cPanel

This tutorial covers on how to prevent any other user to point his/her domain to your dedicated IP and in turn loading your website from this domain name too.

Steps to prevent the same are :
1) Edit your .htaccess file (found in root directory of your website folder). If file doesn’t exists, please create a new file and name it as .htaccess

2) Put these 2 rules at the end of the file :
RewriteCond %{HTTP_HOST} !^www.your-domain.com$
RewriteRule ^/?(.*) http://www.your-domain.com/$1 [QSA,R=301,L]

Note: You can put https in place of http if your website works on https.

And it’s done!

Now any user who will point his/her domain to your website IP will be redirected to your domain only.