这是我输入 .htaccees
的代码文件:
<Files ~ "\.(php|sql)$">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files index.php>
Order Allow,Deny
Allow from all
</Files>
现在我想在 index.php
旁边添加一个目录路径。所以第二个 block 看起来像这样:
.
.
<Files index.php, /myweb/files>
Order Allow,Deny
Allow from all
</Files>
但是这不起作用。注意到<Files index.php | /myweb/files>
也不行。正确的语法是什么?
编辑:现在我有两个.htaccess
文件。其中之一已进入root:
Options -Indexes
<Files ~ "\.(php|sql)$">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files index.php>
Order Allow,Deny
Allow from all
</Files>
另一个是 /myweb/files
文件夹:
Allow from all
但遗憾的是我无法访问.php
/myweb/files
中的文件..我怎样才能访问它们?
最佳答案
您需要在 /myweb/files/.htaccess
中使用此代码来允许访问 files/
中的 *.php
文件目录:
<Files ~ "\.(php|sql)$">
Allow from all
</Files>
关于regex - 如何在 .htaccess 的文件 block 中使用多个路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46161875/