Kevin Haag Kevin Haag - 1 month ago 7
PHP Question

Running Wordpress on localhost, want to make it live on Windows Server 2003

Okay, so I have a client that is insisting that I install Wordpress on their in-house server that is running Windows Server 2003 SP2.

What I've done so far is installed mySQL, PHP, and Wordpress into the publicly accessible directory (ie. www.domain.com brings up the website).

Obviously, if I'm on the server and navigate to

http://localhost
it brings up the working Wordpress site, but what I'm trying to do is change it so that when you navigate to
http://domain.com
it will bring up the site correctly. Currently if you do this, it will bring up the site without any styling or images, because instead of the paths pointing to
http://domain.com/page
it points to
http://localhost/page


Please help me, I've searched everywhere for a solution, but I can't find anything about keeping it on your own server, just moving to another server.

Answer

You have to search/replace in the rest of the database to change all URLs for posts, URLs in content and in meta. Use these queries in phpmyadmin (except for the first one if you have manually changed the site URLs or did so in admin):

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';

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/');

Edit 10/21/16

It's much better to use this PHP script to change URLs, as it correctly handles serialized data in the database; the SQL queries above will break serialized data, and you may loose theme and widget options. See https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

And then also look for hardcoded URLs in style sheets and the theme's functions.php file.