18
votes

403 FORBIDDEN

You don't have permission to access/folder_name/index.php on this server.

Server unable to read .htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Here is .htaccess code:

<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".

3
Please provide your .htaccess codeSahil Gulati
Additionally, ensure the webserver can actually read the htaccess file, as it says it can't. Ensure the permissions are rw-rw-r-- (chmod 644 .htaccess) or some variation, and ensure the user/group Apache is running under has access to that file/directory, assuming you're hosting on Linux.Bytewave
This is my .htaccess code #<Files 403.shtml> order allow,deny allow from all </Files> and i 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" –APARNNA MS

3 Answers

41
votes

Make sure that the .htaccess file is readable by apache:

chmod 644 access/folder_name/.htaccess 

And make sure the directory which contains .htaccess is readable and executable:

chmod 755 access/folder_name/
2
votes

If you are using cpanel, then go to the public HTML folder or else which subfolder creating the problem. right click the folder, you get the option, change permission. make alternative changes accordingly so you can make live your web page enter image description here

0
votes

I had the same issue. I am on rackspeed and use 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.