Getting 403 error after disable PHP execution in .htaccess file.

[ad_1]

I tried to upgrade my site security by disable PHP execution in some directory, by editing the .htaccess in the root folder and adding:

<Files *.php>
deny from all
</Files>

However, after this I am unable to login to my WordPress admin. Getting “403 Forbidden Access to this resource on the server is denied!”. So I have to change it back, anyway does any one know what’s the problem here. I’ve been searching through the Interest and doesn’t seem like this occurs to the others.

[ad_2]
3 Comments
  1. So, when you disabled PHP execution in some directories by adding those lines to your .htaccess file, you inadvertently blocked access to PHP files, including those needed for your WordPress admin. That’s why you’re seeing that 403 Forbidden error when trying to log in.

    WordPress relies heavily on PHP files to run, including those used for admin access. When you deny access to all PHP files in your .htaccess file, it locks down everything, even the files necessary for logging into your admin dashboard.

    To fix this, you’ll want to take a more targeted approach to disable PHP execution. Instead of blocking access to all PHP files, you should only block access to specific directories or files that you want to protect.

    You can achieve this by specifying the directories or files you want to block, rather than using the wildcard (*) to block all PHP files. For example:

    <Files admin.php>
    deny from all
    </Files>

    This would only block access to the “admin.php” file, leaving other PHP files untouched and allowing your WordPress admin to function properly.

    Give that a try and see if it resolves the issue. And remember, always double-check your changes to ensure they don’t inadvertently block access to essential files or directories. If you need further assistance, feel free to ask!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer