Wednesday, May 4, 2011

Joomla:How to move your site to a different server?


Most of you may have created your Joomla site in the localhost and you may be thinking of the way to move it to a live server on the web.
This also applies when you want to move the site from a one live server to another one.
The first thing you need to do is to upload the files to the new server. If your new web host give you a cPanel this is damn easy. (Free web hosts like x10hosting give you a cPanel for controlling your hosting account).
If you have the ability of extracting a compressed file in the server you can transfer your files very easy.
Note! Only *.zip, *.Gz, *.Bz2, or *.tar file types can be extracted in cPanel.
You can use either FTP or the online file manager of your hosting control panel to upload the files. When uploading files be careful to upload either to www folder or to a folder like public_html.
However if the new domain is mapped with a folder inside the public_html folder you need to upload the files there.
Eg: Main domain of my hosting account is sanjaya.me. So if i need to setup a site for sanjaya.me I would upload the files to public_html directly.
If I have created a sub domain jom.author.me which is mapped with the public_html/jom folder I must upload the files to that jom folder.
To upload the files via FTP you can use an FTP client like FileZilla.
(If you don’t have the ability of extracting a compressed file on the server this is the best way you can upload all your files.)

Here you can fill the ftp Host, ftp username and ftp password and connect to the server. You can enter into the correct server folder in the right side and drag and drop the files to it from the left panel which shows the files in your pc.
( You may get the FTP details when you create your hosting account for the first time. Or you may create additional FTP accounts through the page you get when you click FTP accounts button in the cpanel.)
Else you can use the online file manager. Below you see the file manager of cPanel.
Here you see an Upload button where you can upload the files one by one. (nearly impossible to upload thousands of files one by one, but you can upload a compressed file using this way as well as using ftp).
After uploading a compressed file you can extract the file by checking the checkbox for the compressed file and clicking on the extract button.
OK somehow you have now uploaded the files successfully.
Then what you have to do is to get a database prepared for the Joomla site.
First you need to get a database dump of your site.
Go to your localhost’s phpMyAdmin and select your database. Then press export.
Better you check the check boxes which I have marked in orange in the above picture. You may need that when you are importing a dump to a DB where you have data already.
You can press the GO button after selecting a file type.
Now you’ll get a backup of the database as a file.
What you have to do now is to create a database in your live server. In cPanel you can use MySql DataBase Wizard for this. There you can enter the name of the DB, a username and a password. And at last you’ll be asked about the permissions which you must give to the newly created DB user. You can check all the checkboxes there.
Now you have created a DB and a user for it.
Go to phpMyAdmin in your live server, select your database and go to the import tab. There you can see a browser button.
(You may see something like this :
Imported file compression will be automatically detected from: None, gzip, zip. So it means you can upload compressed formats too. Else you need to upload the .sql file directly.)
You can locate the db dump you got from your local server and press GO. So now the data will be imported to the database in the live server.

Now what you have to do is to configure your joomla site to connect to this database. Go to the place where you uploaded the files and find the configuration.php file.
In cPanel File Manager you can use the online editor ( you can see an Edit button on the top). Or you can download the file, edit it and upload again.
Edit the following things in the way that suits with your new DB

var $host = ‘localhost’;
var $user = ‘root’;
var $db = ‘myoldDB’;

var $password = ‘myOldPass’;

$host can be kept same as localhost most of the time.

And you may change the following ones too.
var $log_path = ‘E:\Web\xampp\htdocs\jom\logs’;
var $tmp_path = ‘E:\Web\xampp\htdocs\jom\tmp’;

If everything is OK now you may see the site working.

No comments:

Post a Comment