apache - 防止执行父文件夹的 .htaccess

标签 apache .htaccess mod-rewrite

例如,我在同一个域上有两个不同的站点:
根目录中的第一个站点 http://example.com/
子文件夹中的第二个站点 http://example.com/site2/
每个站点都有自己的 .htaccess
当我进入第二个站点( http://example.com/site2/ )时,在 mod_rewrite 的日志中,我看到 apache 试图执行第一个站点( http://example.com/ )的 .htaccess 。
那么,问题是如何防止这种情况发生?
谢谢

最佳答案

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions

继承

This forces the current configuration to inherit the configuration of the parent. In per-virtual-server context, this means that the maps, conditions and rules of the main server are inherited. In per-directory context this means that conditions and rules of the parent directory's .htaccess configuration are inherited.

Rules inherited from the parent scope are applied after rules specified in the child scope.

关于apache - 防止执行父文件夹的 .htaccess,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3639281/

相关文章:

.htaccess - 网站 self 推荐

linux - 刷新页面时出现数据库被锁定的错误

php - 我可以使用 .htpasswd 来保护不存在的目录(虚拟 m​​od_rewrite 目录)吗?

wordpress - 如何将特定网址的 https 重写为 http?

python - 使用 apache 和 mod_wsgi 提供静态文件而不更改 apache 的配置?

php - 将 Apache 服务器上的所有 .PDF 请求重定向(重写?)到 .php 文件

java - apache commons FileUpload - 在整个文件上传之前切断大文件

mysql - 受损的 DigitalOcean Droplet 路由奇怪的流量

.htaccess - AWS ELB 在没有 index.php 的情况下将 HTTP 重定向到 HTTPS

php - .htaccess RewriteCond,其中 URI 不包含域