Forbidden
You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe. What that means in WordPress
Assistant
User
But how can I access to my WordPress panel to make these changes
Assistant
The error message you're seeing, "Forbidden. You don't have permission to access this resource. Server unable to read htaccess file, denying access to be safe," generally indicates a problem related to the server's .htaccess file within a WordPress environment or more broadly, any server using the Apache web server software. Here's what this means and some possible ways to resolve it:
Understanding the Error
.htaccess File: This is a configuration file used by the Apache web server. It contains rules pertaining to the access and management of directory paths (like those found in a WordPress site). The server reads this file to determine how to handle requests for resources within the directory where the .htaccess file is located.
Permission Issues: The message "Forbidden" and "Server unable to read htaccess file" typically means that the permissions set for the .htaccess file are incorrect - the server doesn't have the required permission to read the file. Alternatively, the file might not exist at all where the server expects it.
Denying Access for Safety: If the server can't read the file (due to permission issues or because it doesn’t exist), it will deny access to the resources to prevent any potential security risks from unauthorized or unregulated access.
Steps to Resolve the Error
Check the .htaccess File Exists: First, ensure that the .htaccess file actually exists in your site's root directory. If not, you'll need to create one.
Correct File Permissions: Check the permissions of your .htaccess file. Usually, permissions should be set to 644 to allow the server to read the file but prevents it from being written to by general web users. You can change this via FTP, a cPanel file manager, or SSH with a command like:
bash
chmod 644 .htaccess
Correct Ownership: Sometimes, the file ownership might be incorrect. The owner of the file should be the user under which your web server operates. Correcting ownership can be more complex and might require the assistance of your hosting provider unless you have root access to manage user settings.
Check File Content: If there are syntax errors in your .htaccess file, it might also cause this error. Ensure that all directives are correct and supported by your server's configuration.
Server Configuration: Some web hosts do not allow users to use .htaccess files or might have specific settings that restrict access unless certain criteria are met. Check with your host if you believe this might be the case.
Restore Default WordPress .htaccess Rules: If your WordPress .htaccess file needs to be recreated, you can replace it with the default WordPress rules:
code
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
By following these steps, you should be able to resolve the issue indicated by the error message. If problems persist, contacting your hosting provider for support is advisable, as they may offer specific insights based on their server configurations.
If the error message you're encountering is preventing access to your WordPress Admin Dashboard, you won’t be able to use WordPress to make these changes. Instead, you will need to resolve the issue using methods that do not rely on WordPress’ administrative interface such as via FTP, cPanel, or SSH.
Here are detailed steps on how to use these methods:
1. Using FTP:
To modify the .htaccess file or check its permissions via FTP, follow these instructions:
Connect to Your Server: Use an FTP client (like FileZilla, WinSCP, etc.) to connect to your web hosting account.
Navigate to the Root Directory: Typically, this is called public_html or www or even the domain name itself, where WordPress is installed.
Find .htaccess File: Look for the .htaccess file in the root directory. If you can't see it, make sure your FTP client is configured to show hidden files (Files that start with a dot . are hidden in Unix-like systems).
Download and Edit .htaccess: Download the .htaccess file, and then you can edit it using a text editor like Notepad++ or Sublime Text. Check for any syntax errors or incorrect settings.
Check and Change Permissions: If the permissions are incorrect, you can often change them directly via the right-click context menu in your FTP client. They should be set to 644.
Upload the File: After making your changes, upload the file back to the server. Ensure it’s in the same location from where you downloaded it.
2. Using cPanel:
If your hosting provides a cPanel or similar web hosting management panel, you can use the File Manager tool:
Log in to cPanel: Access your hosting dashboard and navigate to cPanel.
Open File Manager: Inside cPanel, find and open the “File Manager.”
Go to the Root Directory: Navigate to the directory where your WordPress is installed (usually public_html).
Locate and Edit .htaccess: Find the .htaccess file, right-click on it, and choose Edit. If you see a warning about encoding, proceed with the default settings.
Modify Permissions: If the permission is wrong, right-click on the .htaccess file, select ‘Change Permissions’, and set them to 644.
Save Changes: After making and confirming the changes, save the file directly within the File Manager.
3. Using SSH:
For users comfortable with command line:
Access Server via SSH: Log into your server via a terminal or SSH client.
Navigate to Root Directory: Use cd command to go to the root directory of your WordPress installation.
Edit .htaccess: You can edit files using a command-line editor like nano or vi. For example:
code
nano .htaccess
Check and Modify Permissions: Use ls -l to check permissions and chmod 644 .htaccess to modify them.
Avoid Further Issues
After regaining access, ensure that your WordPress installation, themes, and plugins are all updated to their latest versions. Regular maintenance reduces the risk of issues arising from outdated software and potential incompatibilities.
If after these procedures you are still facing issues, contacting your hosting provider's technical support might be necessary, as they have direct access to server logs and settings that may be causing the issue.