PDA

View Full Version : How to use .htaccess to Prevent direct access to a pointer or subdomain directory



bahattab
05-12-2009, 05:58 PM
Prevent direct access to a pointer or subdomain directory




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 http://maindomain.com/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).

RewriteEngine On
RewriteCond %{HTTP_HOST} !pointerdomain.com$
RewriteRule (.*) http://%{HTTP_HOST} (http://%%7bhttp_host%7d/) [L,R]

Change pointerdomain.com to your pointed domain name or subdomain name (from pointerdomain.com).



http://tips-scripts.com/pointers