Last active
December 19, 2015 13:49
-
-
Save robertkent/5964557 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
################################################################## | |
######## Wordpress .htaccess Boilerplate - Rob's Edition ######## | |
################################################################## | |
### This collection of HTACCESS commands are the strict intellectual property of Creare Communications Ltd ### | |
### Add support for SVG Graphics and CSS3 Pie | |
AddType image/svg+xml svg svgz | |
AddEncoding gzip svgz | |
AddType text/x-component .htc | |
### Default Wordpress Settings: | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
Options +FollowSymlinks | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
#RewriteCond %{HTTPS} =on | |
#RewriteRule ^(.*)$ http://www.creare.co.uk/$1 [R=301,L] | |
RewriteCond %{HTTP_HOST} !^www.creare.co.uk$ [NC] | |
RewriteRule ^(.*)$ https://www.creare.co.uk/$1 [R=301] | |
RewriteCond %{THE_REQUEST} ^.*/index.php | |
RewriteRule ^(.*)index.php$ https://www.creare.co.uk/$1 [R=301,L] | |
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] | |
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] | |
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) | |
RewriteRule ^(.*)$ index.php [F,L] | |
</IfModule> | |
### Protect the wp-config file! | |
<files wp-config.php> | |
order allow,deny | |
deny from all | |
</files> | |
### Creare's Leverage Browser Caching | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType image/jpg "access plus 1 week" | |
ExpiresByType image/jpeg "access plus 1 week" | |
ExpiresByType image/gif "access plus 1 week" | |
ExpiresByType image/png "access plus 1 week" | |
ExpiresByType text/css "access plus 1 week" | |
ExpiresByType application/pdf "access plus 1 month" | |
ExpiresByType text/x-javascript "access plus 1 month" | |
ExpiresByType image/x-icon "access plus 1 year" | |
ExpiresDefault "access plus 2 days" | |
</IfModule> | |
<IfModule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/xhtml text/html text/plain text/xml text/javascript application/x-javascript text/css | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary | |
Header append Vary User-Agent env=!dont-vary | |
</IfModule> | |
### File Compression | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/xml | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE text/javascript | |
AddOutputFilterByType DEFLATE application/x-javascript | |
Header unset ETag | |
FileETag None | |
### 301 | |
#redirect 301 /example.html https://www.creare.co.uk/new-url | |
### Offline Dev Mode | |
#RewriteCond %{REMOTE_ADDR} !^5.102.83.226 | |
#RewriteCond %{REMOTE_ADDR} !^194.74.101.174 | |
#RewriteCond %{REMOTE_ADDR} !^87.224.91.76 | |
#RewriteCond %{REMOTE_ADDR} !^87.224.72.14 | |
#RewriteRule ^(.*)$ http://www.domain.co.uk/$1 [L,R=301] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment