WordPress looks quite daunting when compared to a conventional “file based” web design system. For HTML based publishing, many people have a collection of files and images that are stored in a root directory. These consist of css files, HTML files and more. Moving servers is easy as the files are portable.
WordPress is different because if you look in the root you will see files and folders such as:-
- wp-config.php (contains wordpress settings and passwords)
- index.php (the homepage)
- wp-content folder
- wp-admin folder
You could have a website with 5 pages or 500 pages…. the root folder looks the same! So where are the webpages??? The pages are actually generated from the database. In fact the code on the index.php file (the homepage) looks identical on every one of the millions of WordPress websites. The wp-admin folder is also identical across all WordPress installs. If you look within the wp-content folder, you will start to see huge differences. This folder contains:
- WordPress plugins
- WordPress themes
- An upload folder (containing images + other things)
Moving WordPress Files
It is relatively easy to download the files contained in the root folder (folders and php files) and move them to another server with ftp.
WordPress uses PHP (a programming language) to store and retrieve data from the database. The information stored in a WordPress database include: posts, pages, comments, categories, tags, custom fields, users, and other site options such as web addresses etc.
The WordPress database usually ranges from a few to hundreds of megabytes. Most web hosts have an admin function that allows people to see these databases. These databases can be viewed (not for the faint hearted) with a tool called phpmyadmin. The databases can also be backed up and downloaded.
Once a database is downloaded and the root files and folders are zipped up, it’s quite easy to move a site. This can be done to a new server or even to a new domain.
Moving WordPress Websites The Easy Way
I always use backupbuddy or xcloner to move a website. These two systems zip up the database AND the files into one zip file. These can be restored using a simple script. In my experience 80% of sites can be moved with backupbuddy (the easiest to handle), xcloner works 100% of the time but requires more knowledge. There are many other tools that can move WordPress sites. WordPress can also be moved manually!
The Manual Move!
This process covers moving a WordPress from one domain to another (from A to B):
- Zip the root files from website A (the server files).
- Unzip the files on the target server B.
- Download the MYSQL database from domain A.
- Create a blank database on the new hosting system B (most hosts have a simple one-click method of creating a database. You need to record:
- The database host URL (this is often entered as LOCALHOST or an IP address)
- The database name.
- One database username.
- The database password.
- Restore (import) the database from site A to the new one (most hosts have a one-click restore upload facility)
- We now have the FILES IN PLACE and the DATABASE IN PLACE
- We now need to change the wp-config.php file to:-
- Identify the new database password, username and password
- Define the new website URL
- Edit the database details within the wp-admin.php file by identifying these lines:
/** The name of the database for WordPress */
define( ‘DB_NAME’, ‘THE-DATABASE-NAME-GOES-HERE‘ );/** MySQL database username */
define( ‘DB_USER’, ‘THE-DATABASE-USERNAME-GOES-HERE‘ );/** MySQL database password */
define( ‘DB_PASSWORD’, ‘THE-DATABASE-PASSWORD-GOES-HERE‘ );/** MySQL hostname */
define( ‘DB_HOST’, ‘THE-DATABASE-URL-GOES-HERE‘ );
- The new website URL needs to be defined by adding the following 2 lines to the wp-config.php filedefine(‘WP_HOME’,’https://www.example.com’);
Once the above steps have been done, the website should become visible on the new domain. If you need any help moving websites or backing up, please contact us.