Wordpress - how do you set the domain if you move the site?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Wordpress - how do you set the domain if you move the site?

Post by simonmlewis »

So we have a Wordpress site build on the site's sandbox subdomain.

It's all moved over.

But when I go to wp-admin, it tries to redirect me to the sandbox.domain.com. If I add

Code: Select all

define('WP_HOME','http://www.site.co.uk');
define('WP_SITEURL','http://www.site.co.uk');
to the wp-config, the site loads, but all css and imagery go. So it's breaks.

Are there two places to set the URL?? Or even in the database?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Wordpress - how do you set the domain if you move the si

Post by twinedev »

This is a little old, so you may have solved this, but I will reply anyway in case someone else reads it having the same issue.

You also need to update any content that has the domain coded in (ie. You added media to the page, it will be hard coded to the full URL to the item, it will need to be found and changed in every post.)

The easiest way to do it is use a plugin for moving sites. I myself normally use Duplicator Plugin. When you package up the site, just use it's migration wizard. Upload the package to the "production" server, browse to it's .php file, and from there tell it what the new install settings are, and let it go. It will install the database, put files in place, and search database entries for both URL and table prefix changes and update any needed records. When all done, you can remove the plugin if you don't need it further.
Post Reply