WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i've downloaded a wordpress web to my local machine and tried setting it up. the problem: when trying to login, wordpress will always redirect to the online url. the only way i found was changing the siteurl manually in phpmyadmin to my local machine's ip address. is there a better solution? the problem about doing that is that permalinks won't work anymore locally.


share|improve this question
Not sure why that means the permalinks don't work locally anymore? – Joel Glovier Oct 19 '12 at 18:55
up vote 3 down vote accepted

Open up your wp-config.php file

try adding the following to it:
define( 'WP_SITEURL', 'http://localhost/your_wordpress_folder' );
define( 'WP_HOME', 'http://localhost/your_wordpress_folder' );

share|improve this answer
the only thing to add here is to go to Settings > Permalinks and resave, so that you get a correct .htaccess file – anu Feb 15 '11 at 12:12

If I understand right you had restored backup of live site to local installation?

Basically you have two ways to handle it:

  1. Change site URL (I recommend RELOCATE way, always works nicely for me).

  2. Use hosts file of your OS to point live domain at your local IP (

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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