I’m seeing a lot of errors in apache error log:
(13)Permission denied: [client xyz:63932] AH00529:
/home/username/public_html/.htaccess pcfg_openfile: unable to check
htaccess file, ensure it is readable and that
‘/home/username/public_html/’ is executable Default permissions for
all account’s public_html is 711 and for .htaccess 644.
The owner and group both are set to be respective account’s username. I need this one so I don’t want to change owners and groups.
I’ve been reading various threads and it is confusing. In some thread they say it should be 755 while on others they say to set it 751 (default for cPanel).
What should be default permissions for public_html folders?
3
- Check Permissions
Make sure the public_html directory and the .htaccess file have the right permissions.
For the public_html directory:
chmod 711 /home/username/public_html
This lets the owner read, write, and execute, while others can execute.
For the .htaccess file:
chmod 644 /home/username/public_html/.htaccess
This lets the owner read and write, while others can only read.
- Check Ownership
Make sure the right user (the web server user) owns the public_html directory and the .htaccess file.
Run this command to set ownership:
chown username:username /home/username/public_html/.htaccess
chown username:username /home/username/public_html
Replace username with your account’s username.
- Verify Parent Directory Permissions
Make sure all parent directories leading to public_html are executable (permission x) by the web server user.
For example:
chmod 711 /home/username
4. Look Over Your .htaccess File for Grammar Mistakes
If the permissions and ownership are right, the .htaccess file might have grammar errors. Take a close look at what’s inside to spot any slip-ups.
Tanay Lohani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.