[英]How to select directory and all subdirs
我具有以下文件結構:
/var/www
/var/www/subdirectory
我想用適用於var/www
及其所有子目錄和文件的指令配置apache2.conf。
<Directory "var/www">
僅適用於父目錄。
Direcotry "var/www/*/">
僅適用於子目錄。
澄清度
我正在使用https://github.com/h5bp/server-configs-apache嘗試配置apache2.conf。 因此,我希望所有更改都適用於服務的每個公用文件(root目錄和所有其他文件)。
當我閱讀https://github.com/h5bp/server-configs-apache時 ,我了解到var/www
應該適用於所有子目錄,但是Options -Indexes
規則顯然不起作用(子目錄索引可見)。 當我嘗試var/www/*
,不再顯示索引,但是其他規則未應用於根目錄。
我可以隔離此問題:
<Directory "var/www/*">
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
</Directory>
禁止列出子目錄,而:
<Directory "var/www">
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
</Directory>
才不是。
**更新2 **
供參考,我有以下URL重寫:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
如何將指令同時應用於所有包含的文件?
<Directory>
和</Directory>
用於封裝一組指令,這些指令僅適用於命名目錄,該目錄的子目錄以及相應目錄中的文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.