【问题标题】:Block path using htaccess or some other way使用 htaccess 或其他方式阻止路径
【发布时间】:2015-10-29 10:56:27
【问题描述】:

我正在使用多域托管并且有一个域说 http://demo.com , 它驻留在某个其他域的子域上,比如http://example.com/demo/public_html

我想阻止访问

http://example.com/demo/public_html

http://example.com/demo/

文件夹,因此无法从 http://example.com 访问 可以通过http://demo.com访问demo.com

* 我尝试使用 .htaccess

deny from all

在演示文件夹中,访问被阻止,但http://demo.com 也被阻止。 请帮忙!

【问题讨论】:

    标签: php apache .htaccess mod-rewrite subdomain


    【解决方案1】:

    你可以屏蔽其他域名:

    RewriteEngine on
    RewriteCond %{SERVER_NAME} !^(www\.)?demo\.com$
    RewriteRule ^ - [F]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-23
      • 1970-01-01
      • 1970-01-01
      • 2016-02-24
      • 1970-01-01
      • 2012-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多