diff --git a/inc/setup/cachify.apc.htaccess.php b/inc/setup/cachify.apc.htaccess.php index 48acb9f..ad650c3 100644 --- a/inc/setup/cachify.apc.htaccess.php +++ b/inc/setup/cachify.apc.htaccess.php @@ -8,11 +8,9 @@ /* Quit */ defined( 'ABSPATH' ) || exit; -$beginning = '<Files index.php> - php_value auto_prepend_file '; - -$ending = '/cachify/apc/proxy.php -</Files>'; +$htaccess = ' + php_value auto_prepend_file ' . WP_PLUGIN_DIR . '/cachify/apc/proxy.php +'; // phpcs:disable Squiz.PHP.EmbeddedPhp ?> @@ -21,10 +19,5 @@

+ echo esc_html( $htaccess ); +?> diff --git a/inc/setup/cachify.apc.nginx.php b/inc/setup/cachify.apc.nginx.php index 0408637..72e11ff 100644 --- a/inc/setup/cachify.apc.nginx.php +++ b/inc/setup/cachify.apc.nginx.php @@ -8,17 +8,15 @@ /* Quit */ defined( 'ABSPATH' ) || exit; -$beginning = 'location ~ .php { +$nginx_conf = 'location ~ .php { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; - fastcgi_param PHP_VALUE auto_prepend_file='; - -$ending = '/cachify/apc/proxy.php; + fastcgi_param PHP_VALUE auto_prepend_file=' . WP_PLUGIN_DIR . '/cachify/apc/proxy.php; location ~ /wp-admin/ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; - fastcgi_param PHP_VALUE auto_prepend_file=; + fastcgi_param PHP_VALUE auto_prepend_file=; } }'; @@ -29,12 +27,7 @@

+ echo esc_html( $nginx_conf ); +?> () diff --git a/inc/setup/cachify.hdd.htaccess.php b/inc/setup/cachify.hdd.htaccess.php index e470b0e..4c95b6d 100644 --- a/inc/setup/cachify.hdd.htaccess.php +++ b/inc/setup/cachify.hdd.htaccess.php @@ -8,9 +8,8 @@ /* Quit */ defined( 'ABSPATH' ) || exit; -$beginning = '# BEGIN CACHIFY -<IfModule mod_rewrite.c> - # ENGINE ON +$htaccess = '# BEGIN CACHIFY +; RewriteEngine on # set hostname directory @@ -24,35 +23,31 @@ RewriteRule .* - [E=CACHIFY_DIR:%{REQUEST_URI}] RewriteCond %{REQUEST_URI} ^$ RewriteRule .* - [E=CACHIFY_DIR:/] -{{GZIP}} - # Main Rules - RewriteCond %{HTTP_ACCEPT} .*text/html.* - RewriteCond %{REQUEST_METHOD} GET - RewriteCond %{QUERY_STRING} ="" - RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-content/cache)/.* - RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_ - RewriteCond '; +'; -$gzip = ''; if ( Cachify_HDD::is_gzip_enabled() ) { - $gzip = ' + $htaccess .= ' # 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> + ; '; } -$beginning = str_replace( '{{GZIP}}', $gzip, $beginning ); -$middle = '/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html%{ENV:CACHIFY_SUFFIX} -f - RewriteRule ^(.*) '; - -$ending = '/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html%{ENV:CACHIFY_SUFFIX} [L] -</IfModule> +$htaccess .= ' + # Main Rules + RewriteCond %{HTTP_ACCEPT} .*text/html.* + RewriteCond %{REQUEST_METHOD} GET + RewriteCond %{QUERY_STRING} ^$ + RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-content/cache)/.* + RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_ + RewriteCond ' . WP_CONTENT_DIR . '/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html%{ENV:CACHIFY_SUFFIX} -f + RewriteRule ^(.*) ' . wp_make_link_relative( content_url() ) . '/cache/cachify/%{ENV:CACHIFY_HOST}%{ENV:CACHIFY_DIR}index.html%{ENV:CACHIFY_SUFFIX} [L] +; # END CACHIFY'; // phpcs:disable Squiz.PHP.EmbeddedPhp @@ -62,15 +57,8 @@

+ echo esc_html( $htaccess ); +?>

    @@ -83,7 +71,7 @@

  1. <IfModule mod_cache.c>
    -CacheDisable /
    +  CacheDisable /
     </IfModule>
  2. diff --git a/inc/setup/cachify.hdd.nginx.php b/inc/setup/cachify.hdd.nginx.php index 38b001c..18f56d6 100644 --- a/inc/setup/cachify.hdd.nginx.php +++ b/inc/setup/cachify.hdd.nginx.php @@ -13,9 +13,11 @@