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 trying to work on an existing WordPress site on my Mac using MAMP. I've setup a new database using phpMyAdmin and imported the tables from the backup of the online version. I pasted this into wp-config.php:

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

I used this command in SQL to change the URLs to localhost:

UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com');

When I go to http://localhost the site comes up fine; in the admin I get the dashboard and I can do things like upload and activate a theme, but I am unable to, say, upload new media (get a broken jpg image), or modify the theme – Ultimatum. When I try to go to local pages on the site from the front page, I get the "The requested URL /about was not found on this server."

Any ideas?

share|improve this question
1  
Did you try different settings in wp-config.php for WP_SITEURL and WP_HOME (e.g. http://localhost)? –  tnorthcutt Aug 13 '12 at 12:27
    
i tried that, but i just got localhostlocalhost/about. I'm very new to php, so maybe i'm just being dumb! –  Gavin Aug 13 '12 at 14:36
    
Have you tried flushing your permalink settings? –  boscho Jan 8 '13 at 3:45

1 Answer 1

Yes, while convenient, let's rule out the variable of using the $_SERVER['HTTP_HOST'] trick and put in the absolute URLs.

Here are some handy snippets I use when moving a site (you may want to use these to make sure everything is the same on your install):

UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com','http://www.newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain.com', 'http://www.newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.olddomain.com', 'http://www.newdomain.com');

UPDATE wp_options SET option_value = replace(option_value, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
share|improve this answer
    
Hi Zach, thanks for that. I'm new to WP, but I assume I delete the old code and replace it with your suggestion, modified with my URLs in wp-config.php? –  Gavin Aug 13 '12 at 13:35
    
Hi - ah, sorry for jumping the gun here. What I gave you above are SQL queries that you can run in phpMyAdmin (for example), replacing the olddomain.com and newdomain.com with their respective values. Once running those, it's not a bad idea to login and re-save your permalink structure to update your .htaccess file as well. And yes, add in your full site URL in that wp-config.php file. Thanks! –  Zach Aug 13 '12 at 13:56
    
OK, just seen your reply, so feel free to ignore this: Hi Zach, I did what I suggested above, and now all I get a completely blank page in all browsers, no error message (firebug shows no content other than html, head and body tags) –  Gavin Aug 13 '12 at 13:57
    
What were the steps you did? Please be specific (one by one) and the actual information you entered. What were your SQL query results when you ran those? –  Zach Aug 13 '12 at 13:59
    
Hang on a sec, am just trying this, will get back either way. thanks –  Gavin Aug 13 '12 at 14:03

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.