1

I have like 10 addon domains on my main website, and atm you can visit any addon (call it test1.com) website with link as test1.mainwebsite.com or www.mainwebsite.com/test1

How can I block this access to addons?

I have tried this, but this block only www.mainwebsite.com/test1 way.

   RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?mainwebsite.com$ [NC]
    RewriteCond %{REQUEST_URI} ^/google.com/(.*)$ [OR]
    RewriteCond %{REQUEST_URI} ^/something.net/(.*)$ 
    RewriteRule ^(.*)$ - [L,R=404]
Nutic
  • 1,407
  • 4
  • 16
  • 31
  • May be you could add something like this to your condition RewriteCond %{HTTP_HOST} !^www.mainwebsite.com(.*)$ – Rocky Jan 20 '13 at 17:50

1 Answers1

0

Disable access to a subdomain

The following is an example '.htaccess' code which provides a thorough means of making the Addon domain folders, and their contents, invisible through the main domain by forcing a "404 Not Found" error. This will work both for web browsers and search engines:

RewriteEngine On
        RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ [NC]
        RewriteCond %{REQUEST_URI} ^/addonfolder/(.*)$
        RewriteRule ^(.*)$ - [L,R=404]
Vu Anh
  • 21
  • 5