Moving wordpress site from wamp server to a mamp server
I have been working on a Wordpress site locally on a PC using WAMP but now have started working on a mac so I am using MAMP as my development server.
I have exported my db from the original site and created a new db in phpmyadmin on my mac and imported the original db. I have also copied all of the files over into a folder in htdocs on my mac and changed my wp-config file to match the new settings.
However, when I come to view the site in the browser I keep getting this error "Oops! Google Chrome could not connect to localhost".
I've double checked my wp-config file and all of the settings such as DB Name, User, Password and Host are all correct.
One thing I did notice though was that when I type in the browser:
http://localhost:8888/mysite the URL gets changed to http://localhost/mysite - Im not sure if this is part of the problem or not...
If anybody has any ideas on how to fix the problem it would be greatly appreciated!
Yeah, that is the problem. Wordpress stores the site url in the database, so you need to edit that if the domain changes otherwise it'll just redirect to the old URL. Either go into your database using phpmyadmin and change the siteurl and home (in wp_options) to your new URL, or use the following config options in wp_config.php
You could also go into MAMP's settings and change the apache port from 8888 to 80, that way you won't have to specify a port when developing locally.
If there are links/images in the content, you'll also need to change those links in the database from the old URL to the new one (because wordpress references everything absolutely); there are probably plenty of plugins available to do this, but you could just use a simple replace:
# wordpress fully change domain name: UPDATE wp_posts SET post_content = REPLACE(post_content,'old','new'); UPDATE wp_posts SET guid = REPLACE(guid,'old','new'); UPDATE wp_options SET option_value = 'new' WHERE option_name = 'siteurl' OR option_name = 'home';