Move a Wordpress Website Manually: Difference between revisions

mNo edit summary
Line 1: Line 1:
Manually moving a Wordpress Website to another server or another directory consists several similar steps.
Manually moving a Wordpress Website to another server or another directory consists several similar steps.


*Make a copy of the Database: Using phpMyAdmin, Select the database in the left pane, Export Tab, "Simple" Radio Button, Go Button, save it to a file, done.
=== Database ===
*Make a copy of the Website Files: tar -cvzf /WhatEverDestinationFileName.tar.gz /WhatEverPathToSource/* (De-Compress: gunzip WhatEverFileName.tar.gz, tar xf WhatEverFileName.tar)
If moving to a different database server or changing the name of a database (for consistency or whatever);
**The .htaccess file presents a bit of an issue when "tarring", so copy it manually.
 
*Move or copy the saved database and website files to another server: rsync -vP WhatEverFileName UserName@URLorIPAddress:/WhatEverPath (rsync -vP switch is "verbose" and "progress meter")
'''Export the Database''': Using phpMyAdmin, Select the database in the left pane, Export Tab, "Simple" Radio Button, Go Button, save it to a file, done.
 
'''Create a New Database''': Use the following commands;
 
* mysql -u WhatEverUserName -p
* ...then press enter and type in the database password
* CREATE DATABASE WhatEverDatabaseName;
* GRANT ALL ON WhatEverDatabaseName.* TO 'WhatEverUserName'@'localhost' IDENTIFIED BY 'WhatEverPassword';
* FLUSH PRIVILEGES;
 
...notice the semi-colon at the end of the above commands
 
Import the Database: Using phpMyAdmin, Select the database in the left pane, Import Tab, Browse Button to locate the exported file, Go Button (then wait).  Possible issues can occur here if different PHP time variables aren't set correctly.  Importing can also be done from the command line.  Just noting that here, it's simple to solve, but not addressed here, so don't worry or get frustrated, just Google the error.  Afterall, the original database still exists, so you haven't messed anything up.
 
=== Copy the Files and set / check Permissions ===
 
*If moving the website to a different server: Make a copy of the Website Files;
**tar -cvzf /WhatEverDestinationFileName.tar.gz /WhatEverPathToSource/*
**De-Compress: gunzip WhatEverFileName.tar.gz, tar xf WhatEverFileName.tar
**Copy the 'Zipped File' using one of the below methods
***If Samba is set up, use Windows Explorer
***rsync -vP WhatEverFileName UserName@URLorIPAddress:/WhatEverPath (rsync -vP switch is "verbose" and "progress meter")
**Note: The .htaccess file can present a bit of an issue when "tarring", so check it and copy manually if needed.
 
OR
 
* If moving to a different directory (it is assumed the root directory is /var/www/html, modifiy to suit your location);
** cp -ax WhatEverSourceDirectory WhatEverDesitnationDirectory
*
 
*
 
*Move or copy the saved database and website files to another server:  
*Check or Correct Permissions and Ownership
*Check or Correct Permissions and Ownership
**chown -R apache:apache WhatEverDirectoryName
**chown -R apache:apache WhatEverDirectoryName