3

I've got a WP installation at server-a.example.com (serverA) and I want to duplicate it on a different server which is server-b.example.com (serverB).

My steps are:

  1. Copy database
  2. Copy files
    • No need to edit wp-config.php (database details are just the same, localhost same user same password)
  3. Replace serverA domain with serverB into the database using this tool

The serverB clone seems to work, but I experience two problems:

  1. I cannot login into wp-admin of serverB because I receive the error

    Cookies are blocked or not supported by your browser`

  2. WordPress changes the active theme

Now I'd like to understand the reason behind problem #2, but let that alone for the time being, I've only reported it as it might be a hint for you to spot the real problem.

The question is how do I login? Needless to say, my browser does support cookies and I've tried with different browsers too. I've tried resetting the administrator password via SQL (just in case), but it still blocks me out with the cookies message.

P.S. I'm not sure this question belongs here or serverfault or what else, please move it as needed.

EDIT:

This is not a duplicate because the accepted answer for the other existing question does not hold in my case: there's no Varnish/NGINX/Squid/other reverse proxy on my servers.

4

Wrangled up some things to check:

@otto via comment on this post

Look at the login page's HTML source. Is there anything at all before the initial DOCTYPE line? Even a blank line? If so, then you have some piece of code creating output before the headers are made, in which case this prevents it from setting cookies.

Some suggestions from a highly relevant post with several additional ideas on Stack Overflow:

(I know you said that there's no need to change anything in the wp-config.php file, but references to the old domain could be present. Please verify for sure that this is not necessary.)

Verify the URLs are correct for siteurl and home in the wp_options table. These can be reset easily by adding the following to wp-config.php:

define('WP_HOME','http://your-domain.com');
define('WP_SITEURL','http://your-domain.com');

Check wp-config.php for improperly set DOMAIN_CURRENT_SITE constant.

define( 'DOMAIN_CURRENT_SITE', 'yourdomain.com' );

If the W3 Total Cache plugin was/is in use, temporarily remove the plugin from the plugins directory and ensure that the following lines are commented out/removed from wp-config.php:

define('WP_CACHE', true);
define("COOKIE_DOMAIN", "www.domain.com");

Then, remove the following files from the wp-content directory:

w3-total-cache-config.php 
object-cache.php 
advanced-cache.php
db.php
  • 1
    Thanks. Unfortunately I had already checked: no content before DOCTYPE and no wrong costants in wp-config.php. – Lucio Crusca Sep 13 '16 at 6:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.