Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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.

Dalton

share|improve this answer
    
Worked a treat. Thank you so much –  Gavin Aug 7 '12 at 13:51
    
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. –  Dalton Aug 7 '12 at 14:18
add comment

Your Answer

 
discard

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.