Last active
January 18, 2019 21:09
-
-
Save thegrid22593/937ed4a1731a0ae0a875e029756a55b2 to your computer and use it in GitHub Desktop.
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
# 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 | |
## EXPIRES CACHING ## | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType image/jpg "access plus 1 year" | |
ExpiresByType image/jpeg "access plus 1 year" | |
ExpiresByType image/gif "access plus 1 year" | |
ExpiresByType image/png "access plus 1 year" | |
ExpiresByType text/css "access plus 1 month" | |
ExpiresByType application/pdf "access plus 1 month" | |
ExpiresByType application/javascript "access plus 1 month" | |
ExpiresByType text/x-javascript "access plus 1 month" | |
ExpiresByType application/x-shockwave-flash "access plus 1 month" | |
ExpiresByType image/x-icon "access plus 1 year" | |
ExpiresByType application/vnd.ms-fontobject "access plus 1 year" | |
ExpiresByType application/x-font-ttf "access plus 1 year" | |
ExpiresByType application/x-font-opentype "access plus 1 year" | |
ExpiresByType application/x-font-woff "access plus 1 year" | |
ExpiresByType image/svg+xml "access plus 1 year" | |
ExpiresByType video/mp4 "access 1 month" | |
ExpiresByType video/webm "access 1 month" | |
ExpiresDefault "access plus 2 days" | |
</IfModule> | |
## EXPIRES CACHING ## | |
<IfModule mod_deflate.c> | |
# Compress HTML, CSS, JavaScript, Text, XML and fonts | |
AddOutputFilterByType DEFLATE application/javascript | |
AddOutputFilterByType DEFLATE application/rss+xml | |
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject | |
AddOutputFilterByType DEFLATE application/x-font | |
AddOutputFilterByType DEFLATE application/x-font-opentype | |
AddOutputFilterByType DEFLATE application/x-font-otf | |
AddOutputFilterByType DEFLATE application/x-font-truetype | |
AddOutputFilterByType DEFLATE application/x-font-ttf | |
AddOutputFilterByType DEFLATE application/x-javascript | |
AddOutputFilterByType DEFLATE application/xhtml+xml | |
AddOutputFilterByType DEFLATE application/xml | |
AddOutputFilterByType DEFLATE font/opentype | |
AddOutputFilterByType DEFLATE font/otf | |
AddOutputFilterByType DEFLATE font/ttf | |
AddOutputFilterByType DEFLATE image/svg+xml | |
AddOutputFilterByType DEFLATE image/x-icon | |
AddOutputFilterByType DEFLATE text/css | |
AddOutputFilterByType DEFLATE text/html | |
AddOutputFilterByType DEFLATE text/javascript | |
AddOutputFilterByType DEFLATE text/plain | |
AddOutputFilterByType DEFLATE text/xml | |
# Remove browser bugs (only needed for really old browsers) | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
Header append Vary User-Agent | |
</IfModule> |
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
#### Forward entire domain | |
``` | |
RedirectMatch 301 ^(.*)$ http://www.valenciamorganhill.com/ | |
``` | |
#### Forward entire domain minus images | |
``` | |
RewriteEngine on | |
RewriteCond %{REQUEST_URI} !(\.png|\.jpg|\.gif|\.css|\.js|\.eot|\.svg|\.otf|\.woff|\.ttf)$ | |
RewriteRule ^.+$ / [R=301,NC,L] | |
``` | |
#### Forward entire domain alt. | |
``` | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} ^lyonautumnchase.com$ [OR] | |
RewriteCond %{HTTP_HOST} ^www.lyonautumnchase.com$ | |
RewriteRule ^(.*)$ http://www.lyoncommunities.com/communities/welcome/autumn-chase [R=301,L] | |
``` | |
#### Add SVG Support | |
``` | |
AddType image/svg+xml svg svgz | |
AddEncoding gzip svgz | |
``` | |
#### Redirect non-www urls to www | |
``` | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com | |
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L] | |
``` | |
#### Redirect non-www urls to www (alternate) | |
``` | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com | |
RewriteRule ^(.*) http://www.yoursite.com/$1 [QSA,L,R=301] | |
``` | |
#### Redirect non-www urls to www (except a subdomain) | |
``` | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} !^(dev|www).yoursite.com$ | |
RewriteRule ^(.*) http://www.yoursite.com/$1 [QSA,L,R=301] | |
``` | |
#### Force https:// | |
``` | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] | |
``` | |
#### Force https & www at the same time | |
``` | |
RewriteEngine On | |
RewriteCond %{HTTPS} off [OR] | |
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] | |
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301] | |
``` | |
#### BLOCK ANALYTICS SPAM | |
``` | |
RewriteEngine on | |
RewriteCond %{HTTP_REFERER} bestecommerceseo.com\.com [NC, OR] | |
RewriteCond %{HTTP_REFERER} wakeupseoconsultant\.com [NC, OR] | |
RewriteCond %{HTTP_REFERER} example-spam-website\.com [NC] | |
RewriteRule .* - [F] | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment