0

Currently my server instance is running wordpress (for example: http://12.345.678.901) if that were my ip once you hit that URL you would then get the index page. I'm going to move all this of course to a domain, and wasn't sure what I needed to change on the port over.

(I know about the Apache configs to point to the domain etc.) I'm mostly wondering about url links etc? Can I do the suggested WP_config method? IE:

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

Or do I go hardcore and do a search and replace in the database? (I know previously I had to do that from moving to one server to another, but in this case I'm still on the same server..)

Better to be safe then sorry, thanks for the help!

1

I always run queries in phpmyadmin http://www.phpmyadmin.net or adminer http://www.adminer.org/:

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

Yes, some will say to never change the GUID, but changing the domain gives you no choice. Your posts will show up again in RSS feeds.

Use phpmyadmin or adminer; dumping the database and doing a find/replace with a text editor will break serialized data.

After those queries, do a simple search for the IP to find other instances in options, meta and other tables, etc.

You may find instances of the IP in widget serialized data in the meta and options tables, but change those values in the widget itself, because such serialized data must be the same length or it will break. Or use a find/replace tool at http://interconnectit.com/products/search-and-replace-for-wordpress-databases/ that re-serializes data correctly and can also find/replace all URLs without using the above queries separately.

0

WordPress has an article about this issue in the Codex pages:

http://codex.wordpress.org/Moving_WordPress

There is this Search and Replace for WordPress Databases Script that safely changes all instances without any problems.

If you are a developer, use this option.

There also is a 15-step-solution for this, described in de Moving WordPress Codex page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.