pluginkollektiv / cachify

Smart but efficient cache solution for WordPress. Use DB, HDD, APC or Memcached for storing your blog pages. Make WordPress faster!
https://wordpress.org/plugins/cachify/
GNU General Public License v2.0
101 stars 32 forks source link

cachify.hdd.htaccess.php - should generate right variables #271

Open 1ucay opened 2 years ago

1ucay commented 2 years ago

Hello, thank you for you work.

In wp-config.php I have some personal changes

define( 'WP_DEFAULT_THEME', 'custom' );
define( 'ADMIN_COOKIE_PATH', '/admin' ); /*Im using /admin url */
define( 'SITECOOKIEPATH', '/' );
define( 'TEST_COOKIE', WP_DEFAULT_THEME . '_test' );
define( 'LOGGED_IN_COOKIE', WP_DEFAULT_THEME . '_logged_RANDOM' );
define( 'SECURE_AUTH_COOKIE', WP_DEFAULT_THEME . '_sec_RANDOM' );
define( 'AUTH_COOKIE', WP_DEFAULT_THEME . '_RANDOM' );
define( 'PASS_COOKIE', WP_DEFAULT_THEME . 'pass_RANDOM' );
define( 'USER_COOKIE', WP_DEFAULT_THEME . 'user_RANDOM' );
define( 'RECOVERY_MODE_COOKIE', WP_DEFAULT_THEME . '_rec_RANDOM' );
/* RANDOM is hash */

Also I have define( 'WP_CONTENT_DIR', WEB_ROOT . '/app' );

So these lines

RewriteCond %{REQUEST_URI} !^/(wp-admin|wp-content/cache)/.*
RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_

Shoul be generated over LOGGED_IN_COOKIE, admin_url(), WP_CONTENT_DIR

Thank you.

1ucay commented 3 months ago

also there should be LOGGED_IN_COOKIE

private static function _is_logged_in() {
    /* Logged in */
    if ( is_user_logged_in() ) {
        return true;
    }

    /* Cookie? */
    if ( empty( $_COOKIE ) ) {
        return false;
    }

    /* Loop */
    foreach ( $_COOKIE as $k => $v ) {
        if ( preg_match( '/^(wp-postpass|wordpress_logged_in|comment_author)_/', $k ) ) {
            return true;
        }
    }

    return false;
}