Created
January 10, 2018 16:56
-
-
Save chesio/2768c0ff601065d4d36348839f2e719a to your computer and use it in GitHub Desktop.
.htaccess rules for Cachify on WordPress installations in subdirectory at EDIS vhost
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 Cachify | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
# Set hostname directory | |
RewriteCond %{ENV:HTTPS} =on | |
RewriteRule .* - [E=CACHIFY_HOST:https-%{HTTP_HOST}] | |
RewriteCond %{ENV:HTTPS} !=on | |
RewriteRule .* - [E=CACHIFY_HOST:%{HTTP_HOST}] | |
# Set subdirectory | |
RewriteCond %{REQUEST_URI} /$ | |
RewriteRule .* - [E=CACHIFY_DIR:%{REQUEST_URI}] | |
RewriteCond %{REQUEST_URI} ^$ | |
RewriteRule .* - [E=CACHIFY_DIR:/] | |
# gzip | |
RewriteRule .* - [E=CACHIFY_SUFFIX:] | |
<IfModule mod_mime.c> | |
RewriteCond %{HTTP:Accept-Encoding} gzip | |
RewriteRule .* - [E=CACHIFY_SUFFIX:.gz] | |
AddType text/html .gz | |
AddEncoding gzip .gz | |
</IfModule> | |
# Main rules | |
RewriteCond %{REQUEST_METHOD} !=POST | |
RewriteCond %{QUERY_STRING} ="" | |
RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-content/cache)/.* | |
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_ | |
RewriteCond %{DOCUMENT_ROOT}/wordpress/wp-content/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html -f | |
RewriteRule .* /wordpress/wp-content/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html%{ENV:CACHIFY_SUFFIX} [L] | |
</IfModule> | |
# END Cachify | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment