Steps to secure Wordpress application with .htaccess file.

kumkumsharma

Administrator
Staff member
Inserting some commands in the .htaccess file of your WordPress site can greatly improve its security.

We specify below some typical commands, it being understood that the choice to implement each measure is subjective and must be evaluated case by case.

You can use below code to secure your wordpress application. You just have to add them in your .htaccess file.

You can add below code to restrict access of wp-config.php file:

Code:
<files wp-config.php>
order allow,deny
allow from 127.0.0.1
deny from all
errordocument 403 "This file is forbidden"
</files>
You can add below code to restrict access of xmlrpc.php file:

Code:
<files xmlrpc.php>
order allow,deny
allow from 127.0.0.1
deny from all
errordocument 403 "This file is forbidden"
</files>
You can add below code to restrict access of admin-ajax.php file

Code:
<files admin-ajax.php>
order allow,deny
allow from 127.0.0.1
deny from all
</files>
 
Top