How to work locally on a copy of my wordpress?

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 127.0.0.1 works fine. But all the links still point to my BlogSite.com rather than 127.0.0.1.

Read More

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

Thanks,

Related posts

Leave a Reply

3 comments

  1. 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.

  2. You may also want to add a line in your /etc/hosts file, like this:

    1.2.3.4 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 1.2.3.4.

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

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

  3. 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.