2014-02-28 133 views
1

我在最近购买的托管帐户上设置了一些域,托管服务的工作方式是它有一个主域,然后列出帐户上的其他域或“插件”域作为主域的子文件夹。如何拒绝父文件夹访问子文件夹,但仍然允许直接访问子文件夹?

所以我有maindomain.com,我想保护,noindex,没有关注,只能通过密码等访问,但maindomain.com/anotherdomain真的是anotherdomain.com这是很好,任何人都可以访问。有没有办法阻止对maindomain.com/anotherdomain的访问,同时仍然允许直接访问anotherdomain.com

回答

0

有没有办法阻止访问maindomain.com/anotherdomain,同时仍然允许直接访问anotherdomain.com?

你可以在maindomain.com的文档根目录的.htaccess规则:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.com$ [NC] 
RewriteRule^- [F] 
+0

我试过了,它给了我一个500错误 – tannerwj

+0

是否有可能为你检查你的Apache的error.log中看看错误是什么。 – anubhava

+0

是的,花了我一点时间才发现它,由于可能存在配置错误,请求超过了10个内部重定向的限制。 – tannerwj

相关问题