0

I host & run self-installed WP blogs, but in this instance I'm desperate for some help.

I have a virtual server, via Digital Ocean setup running the latest version of WordPress.

Here's my environment; Digital Ocean Ubuntu 14.04LTS droplet VPS PHP Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies mySQL Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.3

The site binds correctly via its IP, and I've setup Permalinks to be in the format domain/sample-post

I also have a domain set up via Digital Ocean, and that directs to the blog, so mariodecristofanosblog.com correctly points to the WP install.

So what I want to do now is to ensure the site fully resolves via domain name, and not IP. So posts and such like change from 178.62.47.214/my-post to mariodecristofanosblog.com/my-post.

I'm technical. But I'm missing something, I'd really love some help.

I modified the wp-posts sql database via PHPMyadmin to replace all instances of the IP with the full domain name. I used an online tool, to avoid serialization issues and I made sure to only touch the wp-posts database.

I then changes the site URL and home URL settings (General > Settings) to be mariodecristofanosblog.com as opposed to the IP

Finally, I then FTP'ed in and moved the files from the root (www) into a folder called mariodecristofansblog.com

The above is basically a short summary of all the online guides which are available to achieve this. I'm doing something wrong or I'm missing something because I just can't get this to work.

Could someone please please please help!?

0

So to paraphrase your question:

"I set up a VPS at and installed WordPress. Then I set up my domain name. How do I make WordPress think it's at not ?"

From the URL provided I can conclude you have vhosts setup, so it isn't a server setup issue.

The answer is a search replace. You can do it many ways, but you can't just do it on the posts table, it needs to be done across the whole site ( especially post meta and the options table ).

There are several methods of doing it but I'll mention 3:

Import Export

Set up a second site at your domain, separate from the IP site ( you'll need to ammend vhosts, I trust you know how to do that, if not, ask on serverfault ).

On the IP site, do a content export using the WordPress Exporter

On the domain site, put in a fresh install of WordPress, activate all the plugins and themes. Then import the content you exported earlier.

WP CLI

Since you have a VPS there's nothing stopping you installing WP CLI. The homepage has instructions on installation.

But specifically, the search replace command is what you need here. Something similar to this ran in your WordPress directory:

wp search-replace '178.62.47.214' 'mariodecristofanosblog.com'

That command may even do the job! Be sure to do a dry run first using the --dry-run flag

ICIT Search Replace

a screenshot of search replace db 2

Written by Sanchothefat/Robert O'Rourke of Interconnect/IT ( disclosal: former employer of mine ), this is a web based tool. Put it in the same folder as WordPress and it will pick up your wp-config.php. You can then do your search replace.

You can find search replace DB here. Make sure you delete it after you've done your work or it could be reused by someone malicious who finds it

Which To Use?

You don't know what you're doing and have no terminal or Database knowledge

Use Import export and use a 1 click installer to setup the new site at the correct location. It's a faff but anybody can do it given enough time and some instructions.

You're intermediate and know how to upload things

Use ICIT Search Replace. Remember to delete it after using it, and keep in mind it may not be as reliable as the next option due to PHP timeout limits. This is the most convenient and user friendly option if you understand some basics.

You know how to use a terminal command

Congratulations, there should be more developers at your skill level and higher! Use WP CLI and the search replace command. This is the most reliable option.

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.