In /var/www/html I have a site dir. I've duplicated that site's dir and db into a new site dir and db by the name of "test" (without quote marks), and changed wp-config.php accordingly.

I Navigated into this new site dir in console (cd /var/www/html/test), and ran:

wp search-replace 'https://MY_ORIGIAL_DOMAIN' 'https://MY_IP/test'

The site itself goes up and its internal links become based on test, but 2 problems occur:

  1. All css is jumbeled up.
  2. The original site's CSS is also jumbeled up (this is quite wired, I must say).

While I can reverse the result, I admit I don't understand what's going on (because I do everything in the new dir and not in the original dir).


I was wrong, the db wasn't changed to test in wp-config.php... It seems my sed operation failed:

sed -i 's/${domain}/test'/g /var/www/html/test/wp-config.php
  • lots of questions: were the 2 new directories nested or side-by-side. Did you change the wp-config? did you try logging the change or at least reporting with wp-cli?
    – rudtek
    Dec 3, 2017 at 23:16
  • To make sure I'm totally clear, I've edited the question. I would most appreciate if you'd read it again in this more detailed manner. Dec 3, 2017 at 23:20
  • try this: "wp db size" and confirm the db is correct, then also try getting a report, or run a "dry run" of the search replace to see if it's trying to change both db's. put results in question above.
    – rudtek
    Dec 3, 2017 at 23:26

1 Answer 1


The problem was due to some conflict between variable values (I don't recall the exact details).

The solution AFAIR, was to just use another Bash session, without any predefined variables (I just newly defined any variable I needed this time):

$ bash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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