Moving wordpress from localhost to server

WordPress has been a wonderful CMS for blogging. But when it comes to moving wordpress site from localhost to your server it might get some errors. Here is how we can do that job in simple and errorless way.

Moving wordpress from localhost to server

Since you want to transfer your site from localhost to server, you need to replace all the ‘http://localhost/folder’ with your actual site address ‘http://something.com’ in both physical files and your database.

This is easier than installing some kind of wierd plugins, changing image links and all the stuffs.

Step 1: Prepare your files and folders

  • First of all you have to replace localhost with your website address in your physical files before uploading it to your server via FTP.
  • Open any text editor that has an option called “Find in files” (I’m using sublime text editor).
  • Go to Find->Find in Files… or use shortcut ‘Shift+Ctrl+F’.
  • Type ‘http://localhost/wordpress’ in “Find” tab (in stead of /wordpress use your folder name ).
  • Click browse icon … and select add folder and select your project folder (or you can paste the path directly).
  • In “Replace” tab, type ‘http://yoursite.com’.
  • (note: If you put a forward slash at the end of the address in find tab, make your to put a froward slash at the end of the address in Replace tab as well. But it is better to omit forward slash at the end.)
  • Now click Replace button.
    moving-wordpres-from-localhost
  • Now you can upload all the files and folders to your FTP.

Step 2: Export and prepare your Database

  • Go to ‘http://localhost/phpmyadmin’, select your database and export your database in .sql format.
  • Open the exported file with your text editor.
  • Go to Find->Replace… or use shortcut ‘Ctrl+H’.
  • Type ‘http://localhost/wordpress’ in “Find what” tab and type ‘http://yoursite.com’ in “Replace with” tab and click “Replace All” button.
    moving-wordpress-to-server
  • Go to your server’s phpmyadmin (normally you can find it in your hosting account’s control panel).
  • If you don’t have a database already, create one and import the .sql file.

Step 3: edit “wp-config.php”

  • Once all your files are uploaded to your FTP, use file manager in your control panel to edit “wp-config.php” file.
  • Change host, username, password and database name according to your server’s database settings.
  • Now save it and go to your website address.

If you have done everything as instructed you may see your website without any errors.


Anand Roshan

Author: Anand Roshan

An entrepreneur, programmer and a passionate artist who loves to work independently. Get social: Twitter | Google + | Artist Page

Leave a Reply

Your email address will not be published. Required fields are marked *