如何允许使用.htaccess查看(/../)子文件夹中的文件?

如何允许使用.htaccess查看(/../)子文件夹中的文件?,.htaccess,.htaccess,如何允许使用.htaccess查看(/../)子文件夹中的文件 文件夹结构: root/ root/.htaccess root/public root/public/.htaccess root/public/index.php root/public/css root/public/js root/ root/.htaccess root/public root/public/.htaccess root/public/index.php root/public/css root/publ

如何允许使用.htaccess查看(/../)子文件夹中的文件

文件夹结构:

root/
root/.htaccess
root/public
root/public/.htaccess
root/public/index.php
root/public/css
root/public/js
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>   
RewriteEngine On
RewriteBase /public/
Options -MultiViews
#wrong according comments <FilesMatch "public.*" >
  Allow from all
#</FilesMatch>
#the rest of htaccess below
RewriteEngine On
RewriteBase /
Options -MultiViews
Deny from all
RewriteEngine On
RewriteBase /public/

Options -MultiViews
Allow from all
#the rest of code
重新编写引擎打开
重写基/
选项-多视图
全盘否定
#我试图在这里添加公共目录权限,但它不起作用
#使用DirectoryMatch时,我收到一个错误,服务器遇到内部错误或配置错误,无法完成您的请求。
#如果没有DirectoryMatch,我将收到一个错误,您没有访问此服务器上的/type705b/public/index.php的权限。
通融
root/public/.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>   
RewriteEngine On
RewriteBase /public/
Options -MultiViews
#wrong according comments <FilesMatch "public.*" >
  Allow from all
#</FilesMatch>
#the rest of htaccess below
RewriteEngine On
RewriteBase /
Options -MultiViews
Deny from all
RewriteEngine On
RewriteBase /public/

Options -MultiViews
Allow from all
#the rest of code
重新编写引擎打开
基础/公共/
选项-多视图
#错误的评论
通融
#
#下面是htaccess的其余部分
如果我试图查看root/public/index.php,我会得到错误:
禁止您没有访问此服务器上的/root/public/index.php的权限。

更正后,我得到
服务器遇到内部错误或配置错误,无法完成您的请求。

上面代码的错误日志显示
xxx/htdocs/root/.htaccess:如果我没有错,那么您就错了

正确的应该是
,因为您已经有了
RewriteBase/public/



将只允许匹配
公共的文件。*
但作为文件名,而不是路径或目录。

如果我没有错,您有
,那就错了

正确的应该是
,因为您已经有了
RewriteBase/public/



将只允许匹配
公共的文件。*
但作为文件名,而不是路径或目录。

由于您在
public/.htaccess
中没有任何重写规则,因此除了这一行之外,您在
public/.htaccess
中不需要任何内容:

Allow from all

此外,
Files
指令仅用于匹配文件名,因此它永远不会匹配包含目录的文件路径。

由于您在
public/.htaccess
中没有任何重写规则,因此除了这一行之外,您不需要在
public/.htaccess
中使用任何内容:

Allow from all

此外,
Files
指令仅用于匹配文件名,因此它永远无法匹配还包含目录的文件路径。

允许使用.htaccess查看(/../)子文件夹中的文件的工作组合:

文件夹结构:

root/
root/.htaccess
root/public
root/public/.htaccess
root/public/index.php
root/public/css
root/public/js
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>   
RewriteEngine On
RewriteBase /public/
Options -MultiViews
#wrong according comments <FilesMatch "public.*" >
  Allow from all
#</FilesMatch>
#the rest of htaccess below
RewriteEngine On
RewriteBase /
Options -MultiViews
Deny from all
RewriteEngine On
RewriteBase /public/

Options -MultiViews
Allow from all
#the rest of code
root/public/.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>   
RewriteEngine On
RewriteBase /public/
Options -MultiViews
#wrong according comments <FilesMatch "public.*" >
  Allow from all
#</FilesMatch>
#the rest of htaccess below
RewriteEngine On
RewriteBase /
Options -MultiViews
Deny from all
RewriteEngine On
RewriteBase /public/

Options -MultiViews
Allow from all
#the rest of code

使用
给出了错误

允许使用.htaccess查看(/../)子文件夹中的文件的工作组合:

文件夹结构:

root/
root/.htaccess
root/public
root/public/.htaccess
root/public/index.php
root/public/css
root/public/js
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>   
RewriteEngine On
RewriteBase /public/
Options -MultiViews
#wrong according comments <FilesMatch "public.*" >
  Allow from all
#</FilesMatch>
#the rest of htaccess below
RewriteEngine On
RewriteBase /
Options -MultiViews
Deny from all
RewriteEngine On
RewriteBase /public/

Options -MultiViews
Allow from all
#the rest of code
root/public/.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>   
RewriteEngine On
RewriteBase /public/
Options -MultiViews
#wrong according comments <FilesMatch "public.*" >
  Allow from all
#</FilesMatch>
#the rest of htaccess below
RewriteEngine On
RewriteBase /
Options -MultiViews
Deny from all
RewriteEngine On
RewriteBase /public/

Options -MultiViews
Allow from all
#the rest of code

使用
给出了错误

类似地,您可以在站点根目录中使用
Deny from all
。htaccess谢谢,但它不起作用。将“允许坠落”添加到“公共”,会使服务器遇到内部错误或配置错误,无法完成您的请求。
为什么要添加“允许坠落”?我写了
Allow from all
我把Allow from all添加到了code和quesrion中,只有注释有错误。感谢您的关注和回复。同样,您也可以在站点根目录中使用
Deny from all
。htaccess谢谢,但它不起作用。将“允许坠落”添加到“公共”,会使服务器遇到内部错误或配置错误,无法完成您的请求。为什么要添加“允许坠落”?我写了
Allow from all
我把Allow from all添加到了code和quesrion中,只有注释有错误。感谢您的关注和回复。谢谢,它仍然不起作用,现在我收到了错误
服务器遇到了内部错误或配置错误,无法完成您的请求。
请查看
/var/log/apache2/error.log中的错误日志
[Wed May 24 17:51:19.948912 2017][core:alert][pid 4892:tid 1232][client::1:53133]xxx/root/.htaccess:请查看此处谢谢,它仍然不工作,现在我收到错误
服务器遇到内部错误或配置错误,无法完成您的请求。
请查看
/var/log/apache2/error.log中的错误日志。
[2017年5月24日星期三17:51:19.948912][core:alert][pid 4892:tid 1232][client::1:53133]xxx/root/.htaccess:看看这里可能的重复,可能的重复,这正是我在回答中写的。你甚至不需要在这两行中都使用
RewriteEngine
RewriteBase
行。htaccess这正是我在回答中写的。你甚至不需要
RewriteEngine
RewriteBase
行两者都有。htaccess