Managing domain names with WordPress can often be a big pain point for a lot of designers and developers. They can be super knowledgeable about how to build a beautiful looking site on WordPress, but when it comes time to launch the new site with a new domain name, they’re not sure what to do.
Really fast explanation of how to point a domain with WidePath
Don’t want to read further? No problem. Here’s how you setup a new domain with WidePath.
1. Point your domain at cloud.widepath.app (you can do this with ALIAS or CNAME records, but if you really need an IP address, use 184.108.40.206).
2. Login to widepath.app, find your site, then add the new domain name to the list of hostnames. If you want all traffic to go redirect to the www subdomain, then simply click ‘Set Primary’ for the www name.
3. Now you may need to do a search and replace to get rid of references to the old hostname used (could be the temporary hostname). Install the plugin ‘Better Search and Replace’ (https://wordpress.org/plugins/better-search-replace/) then replace ‘https://oldname.widepath.app’ with ‘https://newdomain.com’ and rerun this as many times as needed so that there are no references to your old name.
Here’s a few more details about some of the services related to domain names so that you better understand what’s going on when you have a problem.
Buying the Domain Name
Usually this step is pretty easy and most designers and developers have no problem purchasing the domain name from the domain registrar. Once you have your domain name purchased, the next step is to figure about how to set the domain name servers (aka DNS) for your new domain.
Domain Name Service (DNS)
The domain name service basically just translates names into IP addresses. So in order to get the whole thing started, you need to set your nameservers. Some Domain registrars do this automatically so that you don’t have set the nameservers, they just set them for you and then you can start adding domain records. Domain records are the actual entries that describe which name will map to which IP address.
So in short, you’ve got the nameservers and they dictate the service that will be responsible for changing names into IP addresses. Then you’ve got the actual domain records and these are the entries that actually detail which name turns into which IP address.
We talked quickly about domain records above, but here are a few more details. Domain records have 3 parts:
So typical domain record could look like this:
A www 220.127.116.11
A is the type
www is the name (note that you just specify the subdomain part and not the domain here. That is you put
www and not
18.104.22.168 is the IP address (this is a version 4 IP address, sometimes you might see something like
2001:0db8:85a3:0000:0000:8a2e:0370:7334 which is a version 6 IP address).
Pitfall 1 – Getting Locked out of WordPress
The following might sound familiar.
You point your domain, but then when you try to access your site, WordPress continues to redirect to your old name. But that old name doesn’t work or points elsewhere. So you can’t even get into your WordPress site via
/wp-admin/ now. This problem drives designers and developers crazy! What do you do?
You know that if you could just access your site, you could set the
home options in the
wp_options table. Or put another way, you would just go to Settings > General and edit the
WordPress Address (URL) and
Site Address (URL) settings – you could change them to your new domain and everything would be great. But since you can’t access your site, you’re not sure what to do.
Luckily, WidePath has a neat and simple solution to this problem. Whenever you point a name at WidePath, you can now easily control what happens with that domain using the ‘Hostnames’ section when you’re on a particular site.
Add the domain to the list of hostnames and also include any subdomains you want too (for example, add yourdomain.com and also www.yourdomain.com). Now the magic happens when you click the ‘Set Primary’ button – when you do this, WidePath will automatically set the
home options for you directly in the database. This means you can never get locked out because you’ll always have access to the WidePath control panel.
Pitfall 2 – Now you notice some broken images or maybe a css file not loading
At this point, you start to see your site load at the new domain and content is appearing, but you may notice some weird problems. The page might be unstyled (ie. the CSS isn’t loading) or all the images on the page might be broken.
This might be happening because there could be hardcoded links with your old domain in the database or in your PHP code. To fix the database, you can use a plugin called Better Search and Replace. Simply install that plugin and replace your old domain with the new.
Another way to search and replace in the database is to use
wpcli. You’d simply run
wpcli search-replace https://oldname.com https://newname.com.
So there you have it, we’ve discussed various problems you might have when changing your domain name or adding a new one and how to fix those problems.