I would like to redesign my wordpress site. I thought I do that first locally to get a feeling for it. So I compressed my live wordpress directory and transfered it locally. And took a backup of the database and transfered it locally as well.

I restored from both files the exact copy of my live wordpress on my lcoal machine. Going to works fine. But all the links still point to my BlogSite.com rather than

Is there any quick "fix" for that? Or any other strategy how I could achieve working locally on my website?



3 Answers 3


You may first need to modify the wp-config.php file for using the local database.

Then use the Search and Replace plugin to replace all your live site links with the localhost links. Example: If your live site url is: http://mysite.com/, replace it with http://localhost/mysite/. This will also replace the urls for pages and posts like: http://mysite.com/post with http://localhost/mysite/post.

Note: You'll still need to manually update any links (and image urls) in the widgets, because S and R doesn't replace them.

  • Thanks, I have named the localdb like my live site, so there was no need to edit wp-config.php. I searched and replaced the site reference in the sql dump. But permalinks dont seem to work yet...
    – Houman
    Jun 18, 2012 at 10:55
  • That's because the manual search and replace doesn't work completely! All the urls stored in the wp_options table are searialized, and a manual search and replace won't change them! Upload your sql dump again, and use the plugin I mentioned above. Jun 18, 2012 at 11:00
  • I have reuploaded my dump file without any changes. Then I installed wordpress.org/extend/plugins/search-and-replace. Did teh search and replace in there. It still doesnt work. :(
    – Houman
    Jun 18, 2012 at 11:14
  • Not even the login? Jun 18, 2012 at 11:35
  • login is working :)
    – Houman
    Jun 18, 2012 at 11:38

You may also want to add a line in your /etc/hosts file, like this: www.myblog.example.org

The first line should be the IP of tour TEST machine, the second one is your blog's DNS name.

After adding this line in /etc/hosts "everyone" in your test machine will "know" that www.myblog.example.org is at

You need to change nothing in the database or wordpress settings.

And you can comment/uncomment this line at any time.

  • This seems indeed like a clean alternative. No need to mess around with the dump file. While this solution in it self work, the permalink problem is still there. :(
    – Houman
    Jun 18, 2012 at 14:16
  • @Kave There should not be any issue with permalinks. Check apache's settings, installed/enabled modules, httpd.conf etc. If you "clone" everything (apache, WP, wpdb, settings etc-etc), you should get the same box, a "clone". A line in /etc/hosts simply "workarounds" resolver's behavior. This way works for me perfectly.
    – brownian
    Jun 18, 2012 at 18:20

You should replace all occurences of live website for the local path in your DB dump and in template files (if there are any hardcored urls, i hope not ;) ). Moving WP from server to server goes quite fine, I always copy everything from FTP, then do the database dump (*.sql file for example, you can use for instance phpmyadmin or whatever you prefer), replace all urls for the local ones, import this file in your local DB and change wp-config.php to use correct database settings. So having a "snapshot" of live page can be done in a few minutes.

  • Thanks I have exactly done that. But permalinks doesnt seem to work. the .htaccess is still inside my /var/www/mySite so why doesn't it work?
    – Houman
    Jun 18, 2012 at 10:53
  • so try to go to Options page in WP admin and rebuild all permalinks structure, if it helps?
    – Karel Attl
    Jun 18, 2012 at 10:56
  • ok, I went to WpAdmin -> Settings --> Permalinks and saved it as it was. It saved. I go back to homepage and do refresh. Still all permalinks broken. Any other tip? :)
    – Houman
    Jun 18, 2012 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.