Block other domain pointing our website ip address with .htaccess

How to block other domain pointing our website ip address with .htaccess

Simply add this code below to .htaccess

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mydomain.com$
RewriteRule ^/?(.*) http://www.mydomain.com/$1 [QSA,R=301,L]

This rule will redirects to mydomain.com if another domain is pointing to our website or ip address

 

Leave a Reply

Your email address will not be published. Required fields are marked *