Created
July 30, 2017 21:26
-
-
Save Hendrik44/d0da1c89bd1297057658ddd713efabec to your computer and use it in GitHub Desktop.
wp htaccss template
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
# If mod_headers module is included, we will disable the Server response header totally | |
<IfModule mod_headers.c> | |
Header unset Server | |
Header unset X-Powered-By | |
Header set Connection keep-alive | |
</IfModule> | |
#Security | |
<FilesMatch "\.htaccess|\.htpasswd|wp-config\.php|liesmich\.html|readme\.html|LICENSE|README\.md|bower\.json|package\.json"> | |
order deny,allow | |
deny from all | |
</FilesMatch> | |
<FilesMatch "wp-admin|wp-login\.php"> | |
# IP based restriction | |
order deny,allow | |
deny from all | |
allow from 99.99.99.99 | |
# password based restriction | |
AuthName "Restricted Area" | |
AuthType Basic | |
AuthUserFile /www/htdocs/example/.htpasswd | |
AuthGroupFile /dev/null | |
AuthName Intern | |
require valid-user | |
</FilesMatch> | |
#End Security | |
# Deflate Compression by FileType | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE text/javascript | |
AddOutputFilterByType DEFLATE application/xml | |
AddOutputFilterByType DEFLATE application/xhtml+xml | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/atom_xml | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/x-javascript | |
AddOutputFilterByType DEFLATE application/x-shockwave-flash | |
</IfModule> | |
# turns cache on for 1 month | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType text/css "access plus 1 week" | |
ExpiresByType text/javascript "access plus 1 week" | |
ExpiresByType text/html "access plus 1 month" | |
ExpiresByType application/javascript "access plus 1 month" | |
ExpiresByType application/x-javascript "access plus 1 month" | |
ExpiresByType application/xhtml-xml "access plus 600 seconds" | |
ExpiresByType image/gif "access plus 1 month" | |
ExpiresByType image/jpeg "access plus 1 day" | |
ExpiresByType image/png "access plus 1 day" | |
ExpiresByType image/x-icon "access plus 1 month" | |
</IfModule> | |
<ifmodule mod_headers.c> | |
<filesmatch "\\.(ico|jpe?g|png|gif|swf)$"> | |
Header set Cache-Control "max-age=0, public" | |
</filesmatch> | |
<filesmatch "\\.(css)$"> | |
Header set Cache-Control "max-age=0, public" | |
</filesmatch> | |
<filesmatch "\\.(js)$"> | |
Header set Cache-Control "max-age=0, private" | |
</filesmatch> | |
<filesmatch "\\.(x?html?|php)$"> | |
Header set Cache-Control "max-age=0, private, must-revalidate" | |
</filesmatch> | |
</ifmodule> | |
# gzip Compression if availiable | |
<IfModule mod_gzip.c> | |
mod_gzip_on Yes | |
mod_gzip_dechunk Yes | |
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ | |
mod_gzip_item_include handler ^cgi-script$ | |
mod_gzip_item_include mime ^text/.* | |
mod_gzip_item_include mime ^application/x-javascript.* | |
mod_gzip_item_exclude mime ^image/.* | |
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
</IfModule> | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> | |
# END WordPress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment