[英]How does .htaccess behave when located in directory above doc root
我在 my.htacess 文件中有以下規則。 它們按原樣工作得很好,但我有幾個文檔根目錄,我想對它們應用相同的規則,它們都在同一個父目錄中。 .htaccess 這可能嗎?
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/some/path($|/)
RewriteRule (.*) /some/path/$1 [L]
FallbackResource /some/path/index.html
我知道 .htaccess 在某種程度上與它們所在的目錄有關,所以我想我需要以某種方式修改它們。
將它直接移動到父目錄的最終結果是一切都返回 /some/path/index.html 的內容
對於這有幫助的任何人,我通過將它添加到我的主要 apache 配置的“后虛擬主機”部分來完成此操作。
<Directory "/home/*/parentdirectory/*">
RewriteEngine on
RewriteRule !/some/path/ /some/path%{REQUEST_URI} [L]
FallbackResource /some/path/index.html
</Directory>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.