Local WP installation login and navigation redirects to live site?

I converted an existing site into a cms using WP locally, tested it and it worked fine. Then I published a version of this site on the internet. I was having problems with the permalinks, and trying things with .htaccess. I think in the process, I deleted my .htaccess file from my local site. Now when I try to login in to my local admin area, I get redirected to the live site! and my local site pages link to the live site (with pages not found). How do I fix this mess?

There is a setting in Wordpress under Settings > General called “Wordpress address (URL)” and “Website address (URL)” - They should match the server that you’re running that instance of Wordpress off.

If you migrated the site by importing your local DB into the live DB (or vice versa) you’ll need to change that setting.

From memory it’s a setting in the wp_options table (if you used the default prefix on your tables).

Changing that setting won’t change links in your content though that are linked with a fully qualified URL.

Normally when I migrate from Local to Live (or vice versa) I simply run a Search and Replace on the SQL file.

Thanks, I will try that tomorrow morning. But my problem is that I can’t get into my local WP dashboard to change those settings … can I do it through the database instead maybe? It redirects me as soon as I try to log in.

Yeah, it should be possible to do this directly in the DB :slight_smile:

That did the trick. Thanks for all your help.