.htaccess Permission Denied (Apache, CentOS 7)
According to the Apache wiki this error means you got permission problems with your website root
To diagnose them open a second terminal and issue the following command as root:
su -l apache -s /bin/bash
It will log you as apache
user and will allow to find which directory/file is inaccessible by navigating to your website root with
cd /[website root]/
cat .htaccess
if the following command under apache user doesn't display the contents of .htaccess
file, you should modify the directory/file permissions or the file's owner to allow access. Try issuing the following as root:
chown apache:apache /[website root]/.htaccess
chmod 755 /[website root]/.htaccess
This should fix the error
Related videos on Youtube
Comments
-
Qi Xi over 1 year
I'm encountering an issue with
.htaccess
. I have searched through the Internet and all the solutions didn't work. Please help me! Thx!In the Apache error log, it has the following line:
(13)Permission denied: /[website root]/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/[website root]/' is executable
It seems that it is just a misconfiguration of file permissions. However, changing the
.htaccess
file and the website root directory to755
didn't work. To do an experiment, I changed both the .htaccess and website root to777
, and it didn't work either.Some people says adding
AllowOverride all
into the directory settings, I have already set this and neither adding nor deleting works.I have disabled SElinux, the system environment is CentOS 7.2.1511 + Apache 2.4.6.
Can someone give me some advices please?
I'm thinking that it seems to be an error with file permissions, but it may be an error with something else. Although, I have totally no idea.
Thank you very much!
-
Qi Xi over 8 yearsI have found and followed this document, but it didn't help. Thanks any way
-
Anubioz over 8 years@qi-xi What does it say when you specify
AllowOverride None
? Does it work that way? -
Qi Xi over 8 yearsIt didn't have any error messages in that case, but actually I need the .htaccess to be used.
-
Anubioz over 8 yearstry following updated guide