In WordPress, Sometimes we need to create a password-protected page.
When we create a password-protected page or post then sometimes the site is generating the below error.
When we enter the correct password then the site is redirected redirects to /wp-login.php?action=postpass
– Forbidden : You don’t have permissions to access / on this server !
To solve the Forbidden error, you must need to check the .htaccess file. Please check the below code is available or not on the .htaccess file.
<Files wp-login.php>
Order deny,allow
Deny from all
</Files>
If the above code is available on the .htaccess file then you need to remove it.
Download the .htaccess file to your local computer before making any edits. That way, if you specifically break into your .htaccess file, you only need to upload the original copy to fix the problem.
After removing the code, Please check the password-protected page and it will work properly.
The .htaccess file must be required in the wordpress site. Without the .htaccess file, the site will not be working. In the .htaccess file we can add the redirection code and https-related code and SSL-related code.
The .htaccess file is a configuration file for the Apache web server (which most WordPress hosts use). In other words, there are rules that give different instructions to your website’s server. Almost every WordPress site has an .htaccess file located in the ‘root’ or central directory. It is a hidden file (which is why the file name starts with a period), and has no extensions.
Additionally, some plugins will add their own rules to your .htaccess file to help with the plugin function. This is especially common with caching or security plugins.
It controls how your site’s permalinks are displayed. If you make changes to your permalink structure, the .htaccess file is updated with new instructions for the server. In fact, sometimes an .htaccess file is not actually created on your site unless you first customize your permalinks.