• Hello,

    I installed WordPress multisite and after I added my second website I am getting the following error when I try to access the dashboard:

    ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

    Here is what I have done so far:

    1. I added the subdomain with my hosting provider (secondsite.mainsite.com)
    2. Added the nameserver information to my domain hosting provider (secondsite.com)
    a. Also added the server site IP address to the domain A record)
    3. I did some research and deleted my cache, cookies and history with no luck.
    4. I can access the website if I type in the domain (secondsite.com), but one I try to login, I get the same error.
    5. I also tried adding a redirect (secondstie.com to point to secondsite.mainsite.com). This didn’t work, so I removed it.

    Any suggestions would be greatly appreciated.

Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter apexpredator

    (@apexpredator)

    If anyone has any suggestions or a link to a better guide to install and setup multisite, I would greatly appreciate it. This was just a standard install, so I am not sure what I am doing wrong. I would be willing to start over if it can fix this issue.

    You have a cookie configuration problem. My guess is that you have COOKIE_DOMAIN defined in wp-config.php. How did you configure your second sites domain? Did you just edit siteurl or did you use a plugin.

    Edit: You should be able to log into your second site with the original subdomain url – secondsite.mainsite.com/wp-admin.

    • This reply was modified 6 years, 10 months ago by jkhongusc.
    Thread Starter apexpredator

    (@apexpredator)

    Thank you so much for the reply. I have been struggling with this for months and gave up for a while. I tried a few different options and ended up using the WordPress MU Domain Mapping plugin.

    What I really need to do is setup a few sites with just one page. I could set up a new page and forward the domain to take over the URL (i.e mainsite.com/page to secondsite.com).

    I am open to anything. I just would like to get this fixed and have gone through a few old tutorials with no luck. I have tried not using a plugin and that didn’t work. I currently have a shared hosting package with no dedicated IP address.

    Any suggestions or tutorials on how to set this up would be greatly appreciated.

    If you are using the MU Domain Mapping plugin, then the configuration should be straightfoward. What problems are you having with that plugin? I use the plugin and have my multisite WP configured for multiple domains. The main problem most people will encounter is with ssl certificates for https. If you require https, your host may not be able to handle multiple ssl certs.

    • This reply was modified 6 years, 10 months ago by jkhongusc.
    Thread Starter apexpredator

    (@apexpredator)

    My initial challenge was trying to handle multiple SSL certs. I first tried to setup multisite with no plugin and couldn’t get the domains to point to the new sites (secondsite.mainsite.com) properly.

    What I could really use is this:

    – one main site (SSL)
    – The second site (points to one page with new domain https://www.secondsite.com)
    – The third site (points to one page with new domain https://www.thirdsite.com)

    my challenge is everything I have tried does not allow me to access the second or third site dashboard. I can only access the dashboard if I do not point the new domain to it. I am missing something, so I have been trying to find a tutorial to help me properly set this up with or without a plugin.

    How did you setup your non-main domains? I follow the configuration instructions on the plugin site – https://www.ads-software.com/plugins/wordpress-mu-domain-mapping/

    What wp-admin -> Network -> Settings -> Domain Mapping -> Domain Options did you set? Esp #4 Redirect administration pages…

    Also you would have to map the subsite in wp-admin -> Network -> Settings -> Domains -> New Domain. Enter the site id and mapped Domain: e.g. site_id 2 is mapped to https://www.secondsite.com

    The above should get your subsite (wp-admin) working for http.

    Thread Starter apexpredator

    (@apexpredator)

    Here is what I have setup:

    1. Domain Mapping: 1,3,4
    2. Domains: Site ID: 3 Primary: Not Checked Domain: https://www.secondsite.com/
    3. Second Site Domain Name Server: Hosting package Namer Server Details
    4. Second Site Domain DNS: A record changed to Hosting Package IP Address

    Your configuration is slightly different than mine; but I think it should work. I have:

    1. Domain Mapping: 3,4
    2. Domains: Site ID: 3 Primary: Checked

    What happens when you try to access https://www.secondsite.com/wp-admin/ What kind of error/response do you get?

    Thread Starter apexpredator

    (@apexpredator)

    It will ask me to login again. then I get this message: ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

    I feel like I need some custom code in the wp-config file to fix this?

    > It will ask me to login again. then I get this message: ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

    What url are you using to login: https://www.main.com/wp-login.php or https://www.secondsite.com/wp-login.php? If you are using the secondsite url and getting the Cookies error, check your wp-config.php. See if you have COOKIE_DOMAIN defined in there. Make sure you have sunrise.php in wp-content; which sets the COOKIE_DOMAIN.

    Thread Starter apexpredator

    (@apexpredator)

    I login to https://www.main.com/wp-login.php and when I click the second site dashboard, it kicks me to https://www.secondsite.com/wp-login.php.

    I think the cookie_domain is not set up properly:

    I do not have anything listed in my wp-config file and my sunrise.php is listed below:

    sunrise.php

    <?php
    if ( !defined( ‘SUNRISE_LOADED’ ) )
    define( ‘SUNRISE_LOADED’, 1 );

    if ( defined( ‘COOKIE_DOMAIN’ ) ) {
    die( ‘The constant “COOKIE_DOMAIN” is defined (probably in wp-config.php). Please remove or comment out that define() line.’ );
    }

    $wpdb->dmtable = $wpdb->base_prefix . ‘domain_mapping’;
    $dm_domain = $_SERVER[ ‘HTTP_HOST’ ];

    if( ( $nowww = preg_replace( ‘|^www\.|’, ”, $dm_domain ) ) != $dm_domain )
    $where = $wpdb->prepare( ‘domain IN (%s,%s)’, $dm_domain, $nowww );
    else
    $where = $wpdb->prepare( ‘domain = %s’, $dm_domain );

    $wpdb->suppress_errors();
    $domain_mapping_id = $wpdb->get_var( “SELECT blog_id FROM {$wpdb->dmtable} WHERE {$where} ORDER BY CHAR_LENGTH(domain) DESC LIMIT 1” );
    $wpdb->suppress_errors( false );
    if( $domain_mapping_id ) {
    $current_blog = $wpdb->get_row(“SELECT * FROM {$wpdb->blogs} WHERE blog_id = ‘$domain_mapping_id’ LIMIT 1”);
    $current_blog->domain = $dm_domain;
    $current_blog->path = ‘/’;
    $blog_id = $domain_mapping_id;
    $site_id = $current_blog->site_id;

    define( ‘COOKIE_DOMAIN’, $dm_domain );

    $current_site = $wpdb->get_row( “SELECT * from {$wpdb->site} WHERE id = ‘{$current_blog->site_id}’ LIMIT 0,1” );
    $current_site->blog_id = $wpdb->get_var( “SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}’ AND path='{$current_site->path}'” );
    if ( function_exists( ‘get_site_option’ ) )
    $current_site->site_name = get_site_option( ‘site_name’ );
    elseif ( function_exists( ‘get_current_site_name’ ) )
    $current_site = get_current_site_name( $current_site );

    define( ‘DOMAIN_MAPPING’, 1 );
    }

    • This reply was modified 6 years, 10 months ago by apexpredator.
    Thread Starter apexpredator

    (@apexpredator)

    Does anyone have suggestions on how to fix this code or a link to a tutorial on installing multisite? Everything I have tried has not worked.

    I have three sites on WP MU, and I had this cookie issue when I created the third. The second one was on subdomain, but the third one was on its own domain.

    I mapped the new domain via my hosting provider, added the site – and ran into the cookie problem.

    I have looked through several manuals, made changes to wp-config and broke my first two sites. ?? Now I could log in into the third site which was on it’s own domain, but couldn’t log in into the primary site. No errors, just wouldn’t log me in. The worst thing was that the network dashboard was on the primary site, and I just couldn’t get into it.

    So I recreated the wp-config from scratch (do not forget to add the lines to allow multisite, of course). Then I activated the MU plugin and refreshed/upgraded the network from the network dashboard.

    I didn’t copy sunrise.php anywhere and didn’t define it in wp-config. Simply turned the plugin on. And somehow it fixed the issue.

    I suppose it won’t hurt to try the same.

    Sorry, I didn’t check everything afresh. I cannot access the secondary site now. ?? Will try to follow the manual for MU plugin. ??

    UPD: I did the plugin setup as per its manual, added the new domain in its Domains registry, and now everything works fine.

    See this manual, if you haven’t yet (although I think you have, but just in case): https://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/ The images are of old design, but it doesn’t change the content.

    • This reply was modified 6 years, 8 months ago by Jaaaarne.
    • This reply was modified 6 years, 8 months ago by Jaaaarne.

    Strangely it worked for me (on more than one multisites) to set SUBDOMAIN_INSTALL to false. To be honest, I hadn’t had time to investigate further why …

    define('SUBDOMAIN_INSTALL', false);

    @sternsbergerm

    so I tried to define that as “false” myself (without the mapping plugin) and IT WORKED…
    I accessed my lost dashboard again.

    THANKS for mentioning !

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Can’t Login to My Second Website (Multisite)’ is closed to new replies.