【问题标题】:Htaccess if HTTP_Host then send 403Htaccess 如果 HTTP_Host 然后发送 403
【发布时间】: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


    【解决方案1】:

    试试:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^my\.subdomain\.com$ [NC]
    RewriteRule ^(.*)\.(php|html)$ - [L,F]
    

    【讨论】:

      【解决方案2】:

      将此代码放入您的DOCUMENT_ROOT/.htaccess 文件中:

      RewriteEngine On
      
      RewriteCond %{HTTP_HOST} ^my\.subdomain\.com$
      RewriteRule \.(php|html)$ - [NC,F]
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-05-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-15
        • 2015-05-07
        • 1970-01-01
        相关资源
        最近更新 更多