.htaccess - 使用 cPanel 和插件域时 htaccess 如何工作

标签 .htaccess cpanel

当您拥有 cPanel 主机并使用附加域时,域将“存放”在 public_html 内的文件夹中。文件夹(默认),例如:

A) public_html/.htaccess
B) public_html/addondomain_1/.htaccess
C) public_html/addondomain_2/.htaccess

我的理解是,我放入 htaccess 文件 A) 中的任何内容都适用于其中的所有内容,其中应包括 B) 和 C)。

因此,例如,向 A) 添加被阻止的 IP 地址也会在 B) 和 C) 上被阻止。

但我查询这纯粹是因为 B) 和 C) 在浏览器中查看时是不同的域。我试过测试它,但运气不佳,浏览文档页面并没有帮助我得出结论。

如果我在 A) 中阻止某人的 IP,它会阻止他们访问网站 B) 和 C)?

最佳答案

Apache docs很清楚:

The configuration directives found in a .htaccess file are applied to the directory in which the .htaccess file is found, and to all subdirectories thereof. However, it is important to also remember that there may have been .htaccess files in directories higher up. Directives are applied in the order that they are found. Therefore, a .htaccess file in a particular directory may override directives found in .htaccess files found higher up in the directory tree. And those, in turn, may have overridden directives found yet higher up, or in the main server configuration file itself.



这是 Apache 的功能,而不是 cPanel 的功能。你是否使用 cPanel 运行并不重要——Apache 仍然会遍历父目录并应用它们的 .htaccess指令。

关于.htaccess - 使用 cPanel 和插件域时 htaccess 如何工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14527057/

相关文章:

python - 阻止apache运行python脚本

php - SEO 友好的 .htaccess RuleRewrites

ssl - cPanel 的 AutoSSL 限制

php - codeigniter 中的 Cron 作业

php - .htaccess 拒绝除允许 javascript 访问之外的所有访问

php - 更改页面 URL 并获取前两个字母

.htaccess - UC SSL证书超链接问题

php - FTP::connection() 随机失败

php - 启用 ssl 后 Cron 作业停止工作

php - 隐藏文件夹内容但保持文件可访问