How to prevent direct access to pointer/subdomain directory
Posted: Sat Nov 28, 2009 6:33 pm
If you set up a domain pointer (or subdomain) using a directory that is created within your main domain directory, you can also get to the pointed site by using https://robot.lk/pointerdirectory. You can prevent this using the code below in a .htaccess file in your pointed domain directory. If you try to access the directory with the wrong domain name (not the pointer domain or subdomain) it will re-route the request back to requested domain name (the main domain).
Change robot.lk to your pointed domain name or subdomain name (from robot.lk).
Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} !robot.lk$
RewriteRule (.*) http://%{HTTP_HOST} [L,R]