Skip to content

Forbidden URL error

0

When someone tries to open my aws hosted websites, they get the error:

Forbidden You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe

Apache/2.4.41 (Ubuntu) Server at ramrajyatrust.com Port 80

Only 1 website is working fine, maybe because we use it and access it from backend several times a day, and have not accessed other website in a long time?

1 Answer
0

Based on the error message you're seeing, there are several potential causes for the "Forbidden" error on your AWS-hosted websites:

  1. htaccess file issues: The error specifically mentions that the server is unable to read the .htaccess file. This could be due to:
  • Incorrect file permissions on the .htaccess file
  • A syntax error in the .htaccess file
  • The file being corrupted or inaccessible
  1. Server permissions: The Apache web server user might not have proper permissions to access the website files or directories.

  2. Security group configuration: If you're using EC2 instances, check that your security groups have the proper inbound rules allowing HTTP (port 80) and HTTPS (port 443) traffic.

  3. Web server configuration: Your Apache configuration might need adjustment to properly handle .htaccess files.

To troubleshoot this issue:

  1. Check the permissions on your .htaccess file and website directories. The web server user (often www-data) needs read access.

  2. Verify that the Apache configuration has the correct AllowOverride directive set to enable .htaccess files.

  3. Review your .htaccess file for syntax errors.

  4. Restart your Apache web server after making changes:

sudo systemctl restart apache2
  1. Check Apache error logs for more specific information about the issue.

The fact that one website works while others don't could indeed be related to access patterns, as you suggested. Less frequently accessed sites might have encountered configuration changes, updates, or permission changes that weren't noticed because they weren't being regularly used.
Sources
"We are getting REST API forbidden error from server : https://imgur.com/a/bgLjkdA in wordpress dashboard. | AWS re:Post
failing to access s3 static website via cloud front | AWS re:Post
website down saying can not be reached | AWS re:Post

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.