Prevent subdomain folder access from main domain [HowTo]

If you have a few sites on your host and have subdomain for them then is very important to manage them properly as well.

Ignoring these little things may help you go but have penalty in search engine ranking and security.

It is highly recommended that you should read best practice to manage hosting.

Lets suppose you have a subdomain:

and a main domain:

and a folder for subdomain on your host at:

then you may require to prevent your subdomain from being accessed by folder on main domain. Also it is a good practice.


RewriteEngine on RewriteBase /

#if not already RewriteCond %{HTTP_HOST} !^blog\.website\.com$ [NC] #if request is for blog/, go to RewriteRule ^blog/$ [L,NC,R=301]

Now, that the things are well managed and secured they should also be searchable.