Difference between revisions of "WordPress and Copying or Cloning a Website Manually"
m |
|||
Line 16: | Line 16: | ||
**Modifiy wp_options Table, option_value Column for siteurl Row and home Row | **Modifiy wp_options Table, option_value Column for siteurl Row and home Row | ||
**Better Find and Replace WordPress Plugin / Utility OR Migrate DB Tools, Migrate Tab, Find & Replace Button OR equivalent utility. Don't use phpMyAdmin to do a 'search and replace' as data that's been [[wikipedia:Serialization|serialized]] will get messed up and break a website. | **Better Find and Replace WordPress Plugin / Utility OR Migrate DB Tools, Migrate Tab, Find & Replace Button OR equivalent utility. Don't use phpMyAdmin to do a 'search and replace' as data that's been [[wikipedia:Serialization|serialized]] will get messed up and break a website. | ||
*WordPress | *WordPress | ||
**Consider doing this (generally never hurts anything unless modifications have been made to a site at the file level, which is considered a bad practice): Dashboard, Updates, Re-install version XYZ Button | **Consider doing this (generally never hurts anything unless modifications have been made to a site at the file level, which is considered a bad practice): Dashboard, Updates, Re-install version XYZ Button | ||
*Elementor (if installed) | *Elementor (if installed) | ||
**Elementor, Tools, General Tab, Regenerate Files & Data Button AND Sync Library Button (and possibly clicking on the Save Changes Button, which doesn't seem to be necessary, but it's never explicitly stated by Elementor, so clicking on it won't do any harm) | **Elementor, Tools, General Tab, Regenerate Files & Data Button AND Sync Library Button (and possibly clicking on the Save Changes Button, which doesn't seem to be necessary, but it's never explicitly stated by Elementor, so clicking on it won't do any harm) | ||
*CleanUp and Updates; | |||
**Delete unwanted Pages and Posts | |||
**WP Optimize (general cleanup of database tables) | |||
**PlugIn Updates: Remember, when doing PlugIn updates if any 'blocking' is done for external websites in the wp-config.php file in the name of performance improvement, then 'un-block' them so WordPress can detect all PlugIn updates (IE, Pro, Premium, etc.) | |||
==The Steps== | ==The Steps== |
Latest revision as of 09:56, 3 December 2021
...OK, you've got the perfect website. No, not the content, the Admin Stuff. All of the plugins, settings and other stuff. And now there's a new website you need for yourself or your client. Build the whole thing from scratch. Nope. Clone it, Migrate it, copy it, etc. There are lots of tools out there to do just that. Some are good, some are terrible. If none of them work and you need to do it manually, here's how.
This article is for experts. There's no step by step with pictures. Sorry. It also assumes the use of Apache on CentOS. But it also applies to other web servers like NGinx and other Linux flavors too. It is allso assumed you are proficient with web servers. There are too many dumbed up websites that have so much crap I have to sort through when reading them, I thought it would be nice to have a tight neat site for experts without a bunch of useless extra stuff, just some command to refresh the 'ole memory.
And just to be really clear. This article isn't about just 'cloning' a website to another location as the vast, vast majority of articles are written about. This article deals with a situation where you've got a really good admin 'back end' set up, lots of plugins, everything working great on a website titled ABC.com and you want a new web site on a different subject with different content on a website titled XYZ.net.
Quick S (Quick Summary)
A list of all the major steps
- Directories and Files;
- Copy from Source to Destination
- Set proper Apache Ownership and Permissions
- Search contents of Files for any references to old / source website
- Database;
- Export Source / Import to Destination (new Database)
- Modifiy wp_options Table, option_value Column for siteurl Row and home Row
- Better Find and Replace WordPress Plugin / Utility OR Migrate DB Tools, Migrate Tab, Find & Replace Button OR equivalent utility. Don't use phpMyAdmin to do a 'search and replace' as data that's been serialized will get messed up and break a website.
- WordPress
- Consider doing this (generally never hurts anything unless modifications have been made to a site at the file level, which is considered a bad practice): Dashboard, Updates, Re-install version XYZ Button
- Elementor (if installed)
- Elementor, Tools, General Tab, Regenerate Files & Data Button AND Sync Library Button (and possibly clicking on the Save Changes Button, which doesn't seem to be necessary, but it's never explicitly stated by Elementor, so clicking on it won't do any harm)
- CleanUp and Updates;
- Delete unwanted Pages and Posts
- WP Optimize (general cleanup of database tables)
- PlugIn Updates: Remember, when doing PlugIn updates if any 'blocking' is done for external websites in the wp-config.php file in the name of performance improvement, then 'un-block' them so WordPress can detect all PlugIn updates (IE, Pro, Premium, etc.)
The Steps
- Copy the source sites Directory (and all the files) to a new Directory. If using a Linux based web server, this is the safest way to copy things in that it preserves any symbolic links, etc: cp -ax WhatEverSourceDirectory WhatEverDestinationDirectory
- Set all the Directory and File permissions so the web server is happy and everything works;
- chown -R apache:apache DirectoryName
- find FolderName -type d -exec chmod 755 {} \;
- find FolderName -type f -exec chmod 644 {} \;
- Export the database using the command line or phpMyAdmin (various methods and details here: https://wordpress.org/support/article/creating-database-for-wordpress/)
- Create a new database;
mysql -u WhatEverUserName -p ...it will prompt for a password, type it in. CREATE DATABASE WhatEverDatabaseName; (no dots / periods, underscores are fine) GRANT ALL ON WhatEverDatabaseName.* TO 'WhatEverUser'@'localhost' IDENTIFIED BY 'WhatEverPassword'; FLUSH PRIVILEGES;
- Import the exported database file into the new database. phpMyAdmin is the easiest way, but if it's a big database, watch out for PHP timeouts.
- Commands;
mysqldump WhatEverSourceDatabaseName -u root -p > WhatEverFileName.sql mysql WhatEverDestinationDatabaseName -u root -p < WhatEverFileName.sql
- Commands;
- Change all the references in the wp-config.php file from the old site and database names to the new ones, plus the user name and password for the database if it's different than the source website.
- Edit the wp_options Database Table, siteurl and home row values, changing them to the new website name.
- Create new virtual directory in the web server configuration files (this really glosses over quite a bit, but again, ).
- This includes log file loctions too
- Don't forget SSL stuff (Let's Encrypt, Certbot, etc.): certbot certonly (and remember if one just types certbot it scans the web server configuration files and then if one picks a number off the list Certbot will mess with the configuration files for the web server)
- Use a cool PlugIn named Better Search and Replace to find all instances of the old website name and change them to the new website name.