Created
November 16, 2017 12:59
-
-
Save locvfx/5f8f6fbe513a16001f9fc4e4cb647eb3 to your computer and use it in GitHub Desktop.
.htaccess file works with Vanish cache , serves content via https, should setup in root sub domain
ex: https://images.domain.com
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
#Unset all Cookies! | |
Header unset Cookie | |
Header unset Set-Cookie | |
<IfModule mod_expires.c> | |
# Enable expirations | |
ExpiresActive On | |
# Default directive | |
ExpiresDefault "access plus 1 month" | |
# My favicon | |
ExpiresByType image/x-icon "access plus 1 year" | |
# Media: images, video, audio | |
ExpiresByType image/gif "access plus 1 month" | |
ExpiresByType image/png "access plus 1 month" | |
ExpiresByType image/jpg "access plus 1 month" | |
ExpiresByType image/jpeg "access plus 1 month" | |
ExpiresByType video/ogg "access plus 1 month" | |
ExpiresByType audio/ogg "access plus 1 month" | |
ExpiresByType video/mp4 "access plus 1 month" | |
ExpiresByType video/webm "access plus 1 month" | |
# Webfonts | |
ExpiresByType font/truetype "access plus 1 month" | |
ExpiresByType font/opentype "access plus 1 month" | |
ExpiresByType application/x-font-woff "access plus 1 month" | |
ExpiresByType image/svg+xml "access plus 1 month" | |
ExpiresByType application/vnd.ms-fontobject "access plus 1 month" | |
# CSS and JavaScript | |
ExpiresByType text/css "access plus 1 year" | |
ExpiresByType application/javascript "access plus 1 year" | |
ExpiresByType text/javascript "access plus 1 year" | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header append Cache-Control "public" | |
</IfModule> | |
# -----------------------Force https---------------------------------------------------------- | |
RewriteEngine On | |
# This will enable the Rewrite capabilities | |
RewriteOptions InheritDownBefore | |
# This prevents the rule from being overrided by .htaccess files in subdirectories. | |
RewriteCond %{HTTPS} !=on | |
# This checks to make sure the connection is not already HTTPS | |
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [QSA,R,L] | |
# This rule will redirect users from their original location, to the same location but using HTTPS. | |
# i.e. http://www.example.com/foo/ to https://www.example.com/foo/ | |
# ----------------------\Force https---------------------------------------------------------- | |
RewriteBase / | |
RewriteRule ^size/([0-9]+)/token/(.*)/image/(.*)$ make-thumbnail.php?size=$1&token=$2&image=$3 [NC] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment