Created
September 16, 2022 11:01
-
-
Save ianpegg/3fc5734034f99acccdc662120f353e98 to your computer and use it in GitHub Desktop.
Essential WordPress Apache .htaccess security snippets
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
# ---------------------------------------------------------------------- | |
# Security: Block access to backup and source files | |
# ---------------------------------------------------------------------- | |
<FilesMatch "(\.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$"> | |
Order allow,deny | |
Deny from all | |
Satisfy All | |
</FilesMatch> | |
# ---------------------------------------------------------------------- | |
# Security: Hardening Headers | |
# ---------------------------------------------------------------------- | |
<IfModule mod_headers.c> | |
Header set X-XSS-Protection "1; mode=block" | |
Header always append X-Frame-Options SAMEORIGIN | |
Header set X-Content-Type-Options nosniff | |
</IfModule> | |
# ---------------------------------------------------------------------- | |
# Security: Block XMLRPC as it is deprecated | |
# ---------------------------------------------------------------------- | |
<Files xmlrpc.php> | |
Order Allow,Deny | |
Deny from all | |
</Files> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment