Created
March 7, 2019 21:09
-
-
Save olkitu/35d3bb0c07e268461b3ccc917f7f9d9f to your computer and use it in GitHub Desktop.
Block access to Wordpress files and directory
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
Options -Indexes | |
<files xmlrpc.php> | |
order allow,deny | |
deny from all | |
</files> | |
<files wp-config.php> | |
order allow,deny | |
deny from all | |
</files> | |
<files ~ "^.*\.([Hh][Tt][Aa])"> | |
order allow,deny | |
deny from all | |
satisfy all | |
</files> | |
# Block the include-only files. | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^wp-admin/includes/ - [F,L] | |
RewriteRule !^wp-includes/ - [S=3] | |
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L] | |
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L] | |
RewriteRule ^wp-includes/theme-compat/ - [F,L] | |
</IfModule> | |
# BEGIN WordPress | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
# End WordPress | |
RewriteCond %{HTTPS} off | |
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/ | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment