0

I'm looking for any advice before taking the step of cloning my main site into a sub-but utilizing the same resources.

Is this an easy process? I realize I can strictly instruct my url paths, but in some circumstances the resources come from the media library and I may have to be more diligent.

Has anyone done this? Is there an easy way about going about it?

1 Answer 1

0

If you have access to a Linux/Mac/Unix command line with bash, you can do the following:

  • Export your database to an SQL file.
  • Use sed command with -E to run regex search and replace operations on URLs that do not contain wp-content/uploads (or whichever folder contains your media)
  • Import your SQL file to the new server.

The one "gotcha" would be the regular expression required to exclude your media folder.

If you do NOT have access to bash, or do not have strong regex experience, you might review the WPBeginner article How to clone a Wordpress Site in 7 Easy Steps. A friend of mine has used their method several times.

2
  • One should avoid search & replaces to the Wordpress database because it includes serialized data. If the serialized data contains URLs which are altered to a different length via search&replace, the serialized object is broken and you may lose f. ex. entire theme or plugin configurations.
    – jgangso
    Sep 12, 2023 at 7:08
  • Instead of direct search & replaces on the SQL dump file one could use WP-CLI search-replace command which understands the data types and performs required steps to maintain data integrity. :)
    – jgangso
    Sep 12, 2023 at 7:09

Your Answer

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

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