8

I have 2 domains hosted on the same account but I want to restrict the second one to not access files.

I have abc123.com and zyx987.com.

In my php I do everything I need to display the domain name and template based on the domain but I want only the /download files to be accessed from abc123.com.

The download folder has files like: file1.pdf or file2.zip.

I tried the 'deny from all' but this didnt work since the other domain is blocked too.

Is there another way?

Greg
  • 773
  • 9
  • 22
Owan
  • 205
  • 1
  • 7

1 Answers1

8

Here's what you have to do. Put this in your .htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www.)?zyx987.com$
RewriteRule ^download - [F]

This will block any request like:

/download/
/download/file1.jpg
/download/another/file.zip

and give a permission denied.

Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171