2

I'm trying to move a Wordpress installation in a web hosting to a localhost installation for development. I followed this tutorial (Section Manually Move a Live WordPress Site to Local Server, for now I'm not allowed to install plugins, so I must do it manually).

I'm using MAMP Free edition and followed all the steps in the aforementioned tutorial. But when I tried to open the site in the local installation I got the message (In Safari):

Safari cannot open the page "localhost/sitename" because cannot be connected to server "localhost"

MAMP load sites in localhost:8888/<site-name> so i executed:

UPDATE wp_options 
SET option_value = replace(option_value, 'http://www.thesite.com', 'http://localhost:8888/localsite') 
WHERE option_name = 'home' OR option_name = 'siteurl'; 

where thesite is the name in the web hosting and localsite is the name of the folder in MAMP/htdocs/ where I moved the site's files.

The only weird thing I noted is that the exported DB from the live site does not have a home option in wp_options. I don't know if it's a required row, but the online site was working without it.

What am I missing here? If I followed the tutorial correctly, it should load the site.

If you need some more info about the problem just let me know. Thanks in advance for your answers.

5
  • In the wp-config.php file is that properly connected to your localhost database for your local WordPress site? Commented Aug 23, 2016 at 1:41
  • @EthanJinksO'Sullivan, indeed, it's properly configured (I think). I redefined the properties DB_NAME, DB_USER, DB_PASSWORD and DB_HOST as localhost:8888 (I took the first 3 parameters from the phpmyadmin, you'll understand I cannot publish'em, trust me they are correct) Commented Aug 23, 2016 at 2:06
  • Has this question been resolved? Was my answer helpful? Commented Aug 25, 2016 at 14:39
  • @EthanJinksO'Sullivan, I've been in a rush this days and I didn't have time to try it out. I'll do it this weekend and i'll let you know. Thank you for worrying. Best regards Commented Aug 25, 2016 at 16:02
  • Just checking on your progress Commented Sep 2, 2016 at 11:51

2 Answers 2

0

Changing the home and siteurl in your wp_options table is not enough unfortunately. You will still have your post content with your non-localhost URL (http://www.thesite.com) causing your website to not display properly on your localhost.

You should have the wp_options table on your localhost copy. Everything should be intact. To make sure exported your database from your live site correctly, please follow these quick instructions provided by WordPress.

Once you've downloaded and imported your database to your localhost. Follow these steps:

  1. Go and download Interconnect IT's Database Search & Replace Script here
  2. Unzip the file and drop the folder in your localhost where your WordPress is installed (the root) and rename the folder to replace (screenshot)
  3. Navigate to the new folder you created in your browser (ex: http://localhost:8888/localsite/replace) and you will see the search/replace tool
  4. It should be pretty self-explanatory up to this point: enter your old URL in the search for… field and the new URL in the replace with… field

You can click the dry run button under actions to see what it will be replacing before you execute the script. Once you're done be sure to remove the /replace/ folder.

4
  • It's not the only change I did in the DB, but also all the mentioned in the tutorial, i.e. in tables wp_options, wp_posts and wp_postmeta. However I'll try your solution and let you know, Best regards and thanks for your time Commented Aug 23, 2016 at 4:46
  • Ignore the tutorial that is given from the article you posted. Install a fresh copy of WordPress in your localhost, go through the setup, then replace all the tables in the database with your live site. Then follow my steps above. Commented Aug 23, 2016 at 7:37
  • Sorry, this didn't work for me. For some reason, when I navigate to localhost:8888/localsite/ Wordpress redirects me to localhost/localsite and I don't know why. Any other clue? Commented Aug 29, 2016 at 2:11
  • @AlvaroPedraza If you look at your home and siteurl for your WordPress install, does it include the port number? It should look like this: image From your question above, are you still not seeing a home row in your wp_options? Commented Aug 29, 2016 at 2:33
0

Try This in wp-config.php

define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );

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.