Support » Plugin: Redis Object Cache » Site A redirected to site B

  • Resolved yudia

    (@yudia)


    Hello

    I have Windows server hosting 3 domain.
    I installed the plugin on site A ..everything ok

    Now Im trying to install on site B , editing wp-config but when I click on enabled object cache on plugin seting , site B is redirecting to site A

    Both are wp and my sql are hosted at the same server

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    You need to use a different database index for each site. You can use the WP_REDIS_DATABASE constant to do so:

    https://github.com/rhubarbgroup/redis-cache/wiki/Connection-Parameters#wp_redis_database-default-0

    hi

    i have a similar issue where site gets redirected, and also in plugins review someone also commented the same problem

    https://wordpress.org/support/topic/do-not-install-on-plesk-with-multiple-sites/

    if I have a configuration like this on the first site

    <?php
    define( 'WP_MEMORY_LIMIT', '64M' );
    define( 'WP_CACHE', true );
     // Added by WP Rocket
     // Added by WP Rocket
     // Added by WP Rocket
     // Added by WP Rocket
    /**
     * The base configuration for WordPress
     *
     * The wp-config.php creation script uses this file during the
     * installation. You don't have to use the web site, you can
     * copy this file to "wp-config.php" and fill in the values.
     *
     * This file contains the following configurations:
     *
     * * MySQL settings
     * * Secret keys
     * * Database table prefix
     * * ABSPATH
     *
     * @link https://codex.wordpress.org/Editing_wp-config.php
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define( 'DB_NAME', "site1" );
    
    /** MySQL database username */
    define( 'DB_USER', "root" );
    
    /** MySQL database password */
    define( 'DB_PASSWORD', "mypassword" );
    
    /** MySQL hostname */
    define( 'DB_HOST', "localhost" );
    
    /** Database Charset to use in creating database tables. */
    define( 'DB_CHARSET', 'utf8mb4' );
    
    /** The Database Collate type. Don't change this if in doubt. */
    define( 'DB_COLLATE', '' );
    
    /**#@+
     * Authentication Unique Keys and Salts.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define( 'AUTH_KEY',         'iC@zPufZPZ2*g{Viob8yMt}bkX?' );
    define( 'SECURE_AUTH_KEY',  '4&/eI,R}$]HSVU_.Ek=q~?' );
    define( 'LOGGED_IN_KEY',    '7-pw]Lzu%4:=fF3z,' );
    define( 'NONCE_KEY',        '#;0AVPqinH_' );
    define( 'AUTH_SALT',        '2PCMQ>y>1:$9@J7_JA.' );
    define( 'SECURE_AUTH_SALT', '1FOj[)Ho%ULB)?98NH[3_]Gtuh' );
    define( 'LOGGED_IN_SALT',   ']i.H?8ugY{F+LN<y&}CQ4kWOV:' );
    define( 'NONCE_SALT',       'kY ,&P !YY3yJi0qlXKyY*Cc' );
    
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each
     * a unique prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix = 'wp_';
    
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     *
     * For information on other constants that can be used for debugging,
     * visit the Codex.
     *
     * @link https://codex.wordpress.org/Debugging_in_WordPress
     */
    define( 'WP_DEBUG', true );
    define('WP_CACHE', true);
    define('WP_REDIS_HOST', 'localhost');
    define('WP_REDIS_PORT', '6379');
    define('WP_REDIS_DATABASE', '0');
    define('WP_REDIS_PASSWORD', 'mypassword');
    define('WP_REDIS_MAXTTL', '86400');
    define('WP_REDIS_SCHEME', 'tcp');
    /* That's all, stop editing! Happy publishing. */
    
    /** Absolute path to the WordPress directory. */
    if ( ! defined( 'ABSPATH' ) ) {
    	define( 'ABSPATH', dirname( __FILE__ ) . '/' );
    }
    
    /** Sets up WordPress vars and included files. */
    require_once( ABSPATH . 'wp-settings.php' );

    2nd site wp-config

    <?php
    define( 'WP_MEMORY_LIMIT', '64M' );
    define( 'WP_CACHE', true );
     // Added by WP Rocket
     // Added by WP Rocket
     // Added by WP Rocket
     // Added by WP Rocket
    /**
     * The base configuration for WordPress
     *
     * The wp-config.php creation script uses this file during the
     * installation. You don't have to use the web site, you can
     * copy this file to "wp-config.php" and fill in the values.
     *
     * This file contains the following configurations:
     *
     * * MySQL settings
     * * Secret keys
     * * Database table prefix
     * * ABSPATH
     *
     * @link https://codex.wordpress.org/Editing_wp-config.php
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define( 'DB_NAME', "site2" );
    
    /** MySQL database username */
    define( 'DB_USER', "root" );
    
    /** MySQL database password */
    define( 'DB_PASSWORD', "mypassword" );
    
    /** MySQL hostname */
    define( 'DB_HOST', "localhost" );
    
    /** Database Charset to use in creating database tables. */
    define( 'DB_CHARSET', 'utf8mb4' );
    
    /** The Database Collate type. Don't change this if in doubt. */
    define( 'DB_COLLATE', '' );
    
    /**#@+
     * Authentication Unique Keys and Salts.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define( 'AUTH_KEY',         'iC@zPufZPZ2*g{Viob8yMt}bkX?' );
    define( 'SECURE_AUTH_KEY',  '4&/eI,R}$]HSVU_.Ek=q~?' );
    define( 'LOGGED_IN_KEY',    '7-pw]Lzu%4:=fF3z,' );
    define( 'NONCE_KEY',        '#;0AVPqinH_' );
    define( 'AUTH_SALT',        '2PCMQ>y>1:$9@J7_JA.' );
    define( 'SECURE_AUTH_SALT', '1FOj[)Ho%ULB)?98NH[3_]Gtuh' );
    define( 'LOGGED_IN_SALT',   ']i.H?8ugY{F+LN<y&}CQ4kWOV:' );
    define( 'NONCE_SALT',       'kY ,&P !YY3yJi0qlXKyY*Cc' );
    
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each
     * a unique prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix = 'wp_';
    
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     *
     * For information on other constants that can be used for debugging,
     * visit the Codex.
     *
     * @link https://codex.wordpress.org/Debugging_in_WordPress
     */
    define( 'WP_DEBUG', true );
    define('WP_CACHE', true);
    define('WP_REDIS_HOST', 'localhost');
    define('WP_REDIS_PORT', '6379');
    define('WP_REDIS_DATABASE', '0');
    define('WP_REDIS_PASSWORD', 'mypassword');
    define('WP_REDIS_MAXTTL', '86400');
    define('WP_REDIS_SCHEME', 'tcp');
    /* That's all, stop editing! Happy publishing. */
    
    /** Absolute path to the WordPress directory. */
    if ( ! defined( 'ABSPATH' ) ) {
    	define( 'ABSPATH', dirname( __FILE__ ) . '/' );
    }
    
    /** Sets up WordPress vars and included files. */
    require_once( ABSPATH . 'wp-settings.php' );

    this config redirecting all site (site2, site3,site4 etc) to site1 ,

    is this the correct setup?

    I have the very same problem. Two different wordpress installations on the same server, different domains. One using WP_REDIS_DATABASE 0 and the other one WP_REDIS_DATABASE 1, set via wp-config.php.
    Even after a redis-cli flushall, the site using database 1 still wants to redirect to the first site, when activating the cache. Using an incognito tab to rule out cached redirects also did not help.

    Plugin Author Till Krüss

    (@tillkruess)

    @sebastianflemig: Would you mind posting the diagnostics of both sites?

    Plugin Author Till Krüss

    (@tillkruess)

    @mitratanikita: You need to changed the WP_REDIS_DATABASE to be different on all sites. Using 0, 1, 2 and 3.

    @tillkruess apparently, i need to restart redis service after making changes in wp-config or they will keep redirected

    Can you tell me is there anything wrong in this diagnostic panel (does everything work accordingly ?)

    site 1 diagnostic

    Status: Connected
    Client: PhpRedis (v5.1.1)
    Drop-in: Valid
    Disabled: No
    Ping: 1
    Errors: []
    PhpRedis: 5.1.1
    Predis: Not loaded
    Credis: Not loaded
    PHP Version: 7.3.10
    Plugin Version: 2.0.20
    Redis Version: 3.0.504
    Multisite: No
    Filesystem: Working
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_SCHEME: "tcp"
    WP_REDIS_HOST: "localhost"
    WP_REDIS_PORT: "6379"
    WP_REDIS_DATABASE: "1"
    WP_REDIS_MAXTTL: "86400"
    WP_REDIS_PASSWORD: ••••••••
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes"
    ]
    Unflushable Groups: []
    Drop-ins: [
        "Redis Object Cache Drop-In v2.0.20 by Till Krüss"
    ]

    Site B Diagnostic

    Status: Connected
    Client: PhpRedis (v5.1.1)
    Drop-in: Valid
    Disabled: No
    Ping: 1
    Errors: []
    PhpRedis: 5.1.1
    Predis: Not loaded
    Credis: Not loaded
    PHP Version: 7.3.10
    Plugin Version: 2.0.20
    Redis Version: 3.0.504
    Multisite: No
    Filesystem: Working
    Global Prefix: "wp_"
    Blog Prefix: "wp_"
    WP_REDIS_SCHEME: "tcp"
    WP_REDIS_HOST: "localhost"
    WP_REDIS_PORT: "6379"
    WP_REDIS_DATABASE: "2"
    WP_REDIS_MAXTTL: "86400"
    WP_REDIS_PASSWORD: ••••••••
    Global Groups: [
        "blog-details",
        "blog-id-cache",
        "blog-lookup",
        "global-posts",
        "networks",
        "rss",
        "sites",
        "site-details",
        "site-lookup",
        "site-options",
        "site-transient",
        "users",
        "useremail",
        "userlogins",
        "usermeta",
        "user_meta",
        "userslugs",
        "redis-cache",
        "blog_meta"
    ]
    Ignored Groups: [
        "counts",
        "plugins",
        "themes"
    ]
    Unflushable Groups: []
    Drop-ins: [
        "advanced-cache.php v by ",
        "Redis Object Cache Drop-In v2.0.20 by Till Krüss"
    ]
    Plugin Author Till Krüss

    (@tillkruess)

    Yes, looks good! 👍

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.