Posts Tagged ‘Joomla!’

Backing up and Moving a Joomla website

September 2nd, 2008

Recently we had to move a clients Joomla! website from one host to another. We were not looking forward to doing that because we have never done it before. The website in question is LIVE, so if we messed up, our client, obviously, would not be very happy as you can imagine.

We’ve decided to document the process so that we have this as a guide for future use and decided to share it with you.

What you will need:

Access to your websites Control Panel
Windows computer – For testing the backup
WampServer – Installed on a local computer
PhpMyAdmin – Accessed via your websites Control Panel

Important: Please not that we are not responsible for any loss you may encounter as a result of following this tutorial – this process worked for us – BUT we thoroughly tested the website before we switched web hosts.

Let’s start.

Step 1. Backup your website files

So the first thing we need to do is to backup our website files – basically all the files that make up the website. Using an FTP client, like FileZilla for Windows or CyberDuck for Macs, log in to your websites ftp. Select all your website files and download them to a backup directory for example: My Documents/example-website/backups. This may take a while.

Step 2. Backup your database

Once all your website files have been backed up it’s then time to backup your MySQL database. To do this you will need to log in to your websites Control Panel (CP). Most CPs are different but you should have a Databases section,  go to it and locate your Joomla! websites database. My CP has a Backup function to backup and download the database. If you don’t have this then you need to manage the database and then export all the tables.

Step 3. Install WampServer on a local machine

WampServer will turn your chosen computer into a web server for testing purposes. Download and install WampServer. Follow the on screen instructions and keep the default options.

Step 4. Move the website files

Now that you have installed WampServer, your computer has been turned into a web server. You now have to move the website files to a another folder. Navigate to: c:\wamp\www\ and create a new folder, name it anything you like. For example: c:\wamp\www\testbackup1. Moving the files here means that the site will be accessible to the web server, and you via your web browser.

Step 5. Restore the database using PhpMyAdmin

We now need to recreate the Joomla! database for your website to open PhpMyAdmin from the WampServer icon on your taskbar. Click the WampServer icon and then click on the PhpMyAdmin shortcut.

First you need to create a blank database. To do this enter a name for it in the input box for Create new database and on the drop down list leave the default selection of Collation then click on Create. If successful you will get a message telling you that the database has been created.

Now to import your database click on Import tab, then at the import page select Browse and locate your websites database file and click Open. Now click on the Go button.

If the import was successful, let’s move on to the next stage.

Step 6. Modify the configuration.php file for local use

In order for your Joomla! website to work locally, instead of your domain name, we need to make some changes to the configuration file so it looks for you website locally.

First make a backup of the file and rename it to configuration_backup.php. Open the configuration.php which will be located in the folder you created in c:\wamp\www\.

Find this line: $mosConfig_absolute_path

Change the value to: $mosConfig_absolute_path = ‘c:/wamp/www/testbackup1‘;  – (Replace testbackup1 with your chosen folder name)

Find this line: $mosConfig_cachepath

Change the value to: $mosConfig_cachepath = ‘c:/wamp/www/testbackup1/cache/‘;

Find this line: $mosConfig_db

Change the value to: The name of the database you created in PhpMyAdmin in Step 5. It should look like this: $mosConfig_db = ‘databasename’;

Find this line: $mosConfig_live_site

Change the value to: $mosConfig_live_site = ‘http://localhost/testbackup1‘; – (Replace testbackup1 with your chosen folder name)

Find this line: $mosConfig_password

Change the value to: Leave this blank. $mosConfig_password = ”;

Find this line: $mosConfig_user

Change this value to: $mosConfig_user = ‘root‘;

That’s it for this step.

Step 7. Delete the cache

Now before you open your favourite browser to test your now ‘local’ Joomla! website, we need to delete the contents of the cache folder. You will find this folder inside: c:\wamp\www\testbackup1 – (Replace testbackup1 with your chosen folder name). This caused some issues, as this contains information relating to your website when it was hosted online – so it will get all confused.

Also, watch out for any .htacess files lurking around – if you have a .htaccess file you will need to either move it somewhere safe or rename it. This caused issues for us.

Step 8. Test website

Finally we can test the website to make sure it works as it should, so open your favourite browser (Firefox!) and type http://localhost/testbackup1 in the address bar – remember to replace testbackup1 with your chosen folder name.

Thoroughly test your website; click every link – check absolutely everything. The contact form, if you have one, wont work as we didn’t configure a mail server.

Step 9.  Upload files to new host

If you are happy that your test website is working as it should, you can then begin the moving process. At this stage you should have your new host account all setup and ready to go.

Let’s start – first we need to replace the configuration.php file we modified for our local test version, so replace it with the backup you made. Now launch your favourite FTP client and login to your domain on the new host and upload all your files. Time to get a cup of coffee as this might take a while.

Step 10. Recreate your database

While the files are uploading, we can recreate the MySQL database for your website. Login to your web hosts’ Control Panel and go through to the MySQL or Databases section. Create a new MySQL database – keep the same username and password as in the configuration.php file.

Once you have recreated your database you need to upload the content of your database. Your host should allow you to Manage or Edit your database – so click on the option you have. Most web hosts use PhpMyAdmin to manage databases.

Now that you have uploaded your website files and recreated the database – you are ready for the final step – testing!

Step 11. Testing the website

So before you pat yourself on the back for a job well done, you need to test the website thoroughly – this means checking everything, every link, your contact form. Make sure that everything works as it did before the move.

If your happy that everything works – then you can go ahead and pat yourself on the back. Well done!