I'm new to WordPress. A friend asked me to redesign his WP blog and I've installed it on my Mac using MAMP. I went through the database setup and imported the site's existing DB and added the tables. It all looks good, as far as I can tell, on the phpMyAdmin site.

When I go to url "localhost" in Chrome (and other browsers) I see the blog's front page, which is definitely local, but if I try to login, I'm sent back online. This also happens if I click on any of the links in the blog.

I've check that wp-config.php DB_NAME matches the name of the DB I downloaded. Anyone got any ideas what's going on?

Thanks Gavin

1 Answer 1


Try adding this to your wp-config.php file:

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST']);

That will define your site URL as whatever happens to be in the browser location bar. Very useful for moving a site from server to server without actually changing the siteurl and home location in the database. Just don't leave this on a production site.


  • Awesome, glad to hear it! It would be great if you could mark this as the accepted answer so others can find it as well. Aug 7, 2012 at 14:18

Your Answer

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

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