Last active
January 30, 2023 13:04
-
-
Save jennimckinnon/3fd2963084511a466f62874d8912543b to your computer and use it in GitHub Desktop.
Restrict Direct Access to Plugin and Theme PHP files in WordPress. Source: https://www.acunetix.com/websitesecurity/wordpress-security-top-tips-secure-wordpress-application/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment