【发布时间】:2017-05-24 14:12:13
【问题描述】:
如何允许使用 .htaccess 查看 (/../) 子文件夹中的文件?
文件夹结构:
root/
root/.htaccess
root/public
root/public/.htaccess
root/public/index.php
root/public/css
root/public/js
root/.htaccess
RewriteEngine On
RewriteBase /
Options -MultiViews
<FilesMatch ".*">
Deny from all
</FilesMatch>
#i tried to add here, public directory permission, but it does not work
#with DirectoryMatch i am getting the error The server encountered an internal error or misconfiguration and was unable to complete your request.
#without DirectoryMatch i am getting the error You don't have permission to access /type705b/public/index.php on this server.
<DirectoryMatch "/public.*">
Allow from All
</DirectoryMatch>
root/public/.htaccess
RewriteEngine On
RewriteBase /public/
Options -MultiViews
#wrong according comments <FilesMatch "public.*" >
Allow from all
#</FilesMatch>
#the rest of htaccess below
如果我尝试查看 root/public/index.php,我会收到错误消息:Forbidden You don't have permission to access /root/public/index.php on this server.
更正后,我收到The server encountered an internal error or misconfiguration and was unable to complete your request.
上面代码的错误日志显示xxx/htdocs/root/.htaccess: <DirectoryMatch not allowed here
【问题讨论】:
标签: .htaccess