0

Exist a way in Htaccess to say If HTTP_HOST = my.subdomain.com Then block access (403) for the files .php and .html?

I want that the only files accessible throug my subdomain are Images.

2 Answers2

1

Try:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^my\.subdomain\.com$ [NC]
RewriteRule ^(.*)\.(php|html)$ - [L,F]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
0

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^my\.subdomain\.com$
RewriteRule \.(php|html)$ - [NC,F]
anubhava
  • 761,203
  • 64
  • 569
  • 643