Skip to content

Instantly share code, notes, and snippets.

@mcguffin
Last active August 11, 2022 17:30
Show Gist options
  • Select an option

  • Save mcguffin/02e27780631ed63182c99d6f29be4aef to your computer and use it in GitHub Desktop.

Select an option

Save mcguffin/02e27780631ed63182c99d6f29be4aef to your computer and use it in GitHub Desktop.

Revisions

  1. mcguffin revised this gist Aug 11, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .htaccess
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ RewriteRule .* - [E=CACHIFY_SUFFIX:]
    </IfModule>

    # Main Rules
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{THE_REQUEST} !^POST.*
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-content/cache)/.*
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
  2. mcguffin renamed this gist Dec 13, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. mcguffin created this gist Dec 13, 2017.
    37 changes: 37 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    # BEGIN CACHIFY
    <IfModule mod_rewrite.c>
    # ENGINE ON
    RewriteEngine on
    RewriteBase /

    # set hostname directory
    RewriteCond %{HTTPS} on
    RewriteRule .* - [E=CACHIFY_HOST:https-%{HTTP_HOST}]
    RewriteCond %{HTTPS} off
    RewriteRule .* - [E=CACHIFY_HOST:%{HTTP_HOST}]

    # set subdirectory
    # sometimes %{REQUEST_URI} might be an empty string, so /$ won't match
    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>/wp-content/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html -f
    RewriteRule ^(.*) /wp-content/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html%{ENV:CACHIFY_SUFFIX} [L]
    </IfModule>
    # END CACHIFY