
How to Restrict Access to WordPress Core PHP Files-: Do you want to restrict your core WordPress file so in case of attack hacker hand would not reach to your core file? Keep reading this Post you will get in-depth information on How to Restrict core WordPress File.
WordPress is one of the most popular CMS with over 35% of internet website are build on WordPress CMS at this time of writing this post. There other CMS like Squarespace, Joomla, Drupal etc but use by only fewer sites. WordPress is far ahead as compared to its competitor. Previously WordPress users to create a blog or website But now WordPress core code changed a lot as well as a massive ecosystem of plugins and theme, you can create any type of website with WordPress.
As WordPress is more popular CMS, therefore, it is the main target for a hacker. As per Sucuri WordPress accounted for 90 per cent of all hacked CMS sites in 2018. WordPress is very secure by default itself most of the security breach occurs due to the use of theme and plugin from unauthorized sources. on WordPress Platform website security hardening means securing a website by reducing its surface of vulnerability. More use of theme and plugin, Showing directory or WordPress version provide a potential entry point to the hacker.
Sucuri experts blamed most of the hacks on vulnerabilities in plugins and themes, misconfiguration issues, and a lack of maintenance by webmasters, who often forgot to update their CMS, themes, and plugins.
How to Restrict Access to WordPress Core PHP Files-:
On self-hosted WordPress, you have to take care of your WordPress Blog With your own. WordPress website major security breach happens when a user discloses its core Files. there is a number of ways to secure your WordPress Website with little modification to your WordPress core file. If you do not want to add some code to your WordPress Website to make it secure, I would recommend you to use WordPress security plugin like Wordfence.
Add the following code to your WordPress .htaccess files to restrict access to your WordPress Core PHP files so that hacker would not be able to inject any code. Below code are basically Rewrite Rule. Please take a backup of your .htaccess before making any changes.
RewriteCond %{REQUEST_URI} !^/wp-content/plugins/file/to/exclude\.php
RewriteCond %{REQUEST_URI} !^/wp-content/plugins/directory/to/exclude/
RewriteRule wp-content/plugins/(.*\.php)$ – [R=404,L]
RewriteCond %{REQUEST_URI} !^/wp-content/themes/file/to/exclude\.php
RewriteCond %{REQUEST_URI} !^/wp-content/themes/directory/to/exclude/
RewriteRule wp-content/themes/(.*\.php)$ – [R=404,L]