WordPress localhost redirects to live site

Saturday, May 2, 2015

When you are developing on WordPress sites it's always quicker to work on a local machine/development server. It's essential to work from the same data as the live site so you can work effectively as possible so taking a copy of the live database and installing it locally is the best and quickest option... but there is one potential pitfall.

Because WordPress store site settings in the database it means that all the site addresses that were on the live site are now on your development site, meaning every action you take on your development site such as logging in or saving a post will redirect to the live site and fail. Luckily there is a quick fix:

  1. Login to your local/development database (probably via phpMyAdmin) and find the table wp_options.
  2. Update the entry siteurl to your development server address.
  3. Update the entry home to your development server address.

Once you have updated the entries your links and actions such as logins will work again. This also applies if you ever change your domain name to another.


Other posts


Tagged with: