【发布时间】:2014-08-22 02:25:48
【问题描述】:
在 Htaccess 中是否存在一种方式来表示 If HTTP_HOST = my.subdomain.com Then block access (403) for the files .php 和 .html?
我希望通过我的子域访问的唯一文件是图像。
【问题讨论】:
标签: php html apache .htaccess http-host
在 Htaccess 中是否存在一种方式来表示 If HTTP_HOST = my.subdomain.com Then block access (403) for the files .php 和 .html?
我希望通过我的子域访问的唯一文件是图像。
【问题讨论】:
标签: php html apache .htaccess http-host
试试:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^my\.subdomain\.com$ [NC]
RewriteRule ^(.*)\.(php|html)$ - [L,F]
【讨论】:
将此代码放入您的DOCUMENT_ROOT/.htaccess 文件中:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^my\.subdomain\.com$
RewriteRule \.(php|html)$ - [NC,F]
【讨论】: