简体   繁体   English

服务器无法读取 htaccess 文件,拒绝访问是安全的

[英]Server unable to read htaccess file, denying access to be safe

403 FORBIDDEN 403 禁止

You don't have permission to access/folder_name/index.php on this server.您无权access/folder_name/index.php此服务器上的access/folder_name/index.php

Server unable to read .htaccess file, denying access to be safe服务器无法读取.htaccess文件,拒绝访问以确保安全

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.此外,在尝试使用ErrorDocument处理请求时遇到 403 Forbidden 错误。

Here is .htaccess code:这是.htaccess代码:

<Files 403.shtml> 
order allow,
deny allow from all 
</Files> 

And I also tried another code:我还尝试了另一个代码:

<Directory "/path/to/source/file/directory/www"> 
Options Indexes FollowSymLinks 
AllowOverride all 
Require all granted 
</Directory> 

But I am confused on the line "path/to/source/file/directory/www".但我对“path/to/source/file/directory/www”这一行感到困惑。

Make sure that the .htaccess file is readable by apache :确保.htaccess文件可以被apache读取:

chmod 644 access/folder_name/.htaccess 

And make sure the directory which contains .htaccess is readable and executable:并确保包含.htaccess的目录是可读和可执行的:

chmod 755 access/folder_name/

If you are using cpanel , then go to the public HTML folder or else which subfolder creating the problem.如果您使用的是cpanel ,请转到公共HTML文件夹或创建问题的子文件夹。 right click the folder, you get the option, change permission.右键单击该文件夹,您将获得更改权限的选项。 make alternative changes accordingly so you can make live your web page相应地进行替代更改,以便您可以使您的网页上线在此处输入图片说明

I had the same issue.我遇到过同样的问题。 I am on rackspeed and use cpanel.我在机架速度并使用 cpanel。 I created a subdomain which also created the base folder.我创建了一个子域,它也创建了基本文件夹。 But I deleted the base folder and created it again, which caused the error.但是我删除了基本文件夹并重新创建了它,这导致了错误。

I had to open the subdomain configuration and edit the base directory.我必须打开子域配置并编辑基本目录。 The correct base directory was already entered but I had to do It again nevertheless, to make it reinitialize.已经输入了正确的基本目录,但我不得不再次这样做,以使其重新初始化。

  1. Go to the terminal on linux 转到linux上的终端
  2. Path to your html folder 你的html文件夹的路径
  3. sudo chmod -R 777 your_directory_name sudo chmod -R 777 your_directory_name

Where 'your_directory_name' is the directory that contains .htaccess file. 其中'your_directory_name'是包含.htaccess文件的目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM