Change domain name in hosting package
It may happen that the built website needs to be linked to a different domain. The easiest way to handle this is to change the domain name. This approach ensures that the website does not have to be transferred via a workaround.
Step 1
To change your domain name, you must first log into DirectAdmin. Read in this article how to log into DirectAdmin.
Step 2
After logging into DirectAdmin, navigate under “Account Manager” to “Domain Setup” and click on "Rename Domain" at the top. Select the domain you want to change.
On this page, the domain name can be changed. Please note that no website will be displayed on the old domain name anymore. The old domain name will no longer exist in DirectAdmin after this. It can, however, be added again afterwards.
Select the domain name in the dropdown and enter the desired new domain name. Then press the “Change” button. The website is now transferred to the new domain name. Have fun with your new domain!
If an error occurs, the domain name already exists in DirectAdmin. It must first be removed before it can be added again. Please note: If the domain name is removed, all files on the hosting will also be removed.
Extra: Changing the domain name within the WordPress website
Now that the domain name has been changed within the hosting, the WordPress website will give an error message. This is because WordPress still refers to the old domain name. We have set up a few steps for this:
Step 1
Go to DirectAdmin via the mijn.host control panel. Next, go to phpMyAdmin via "MySQL Management" under "Account Manager".
Step 2
In phpMyAdmin, click on the name of your database. Next, click on “SQL”, so we can execute a query (command) here. Copy the following code:
SET @oude_domeinnaam = 'oud-domein.nl';nt, CONCAT('https://www.', @oude_domeinnaam), CONCAT('https://www.', @nieuwe_domeinnaam));
SET @nieuwe_domeinnaam = 'nieuw-domein.nl';
UPDATE wp_options SET option_value = replace(option_value, CONCAT('https://', @oude_domeinnaam), CONCAT('https://', @nieuwe_domeinnaam)) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_options SET option_value = replace(option_value, CONCAT('https://www.', @oude_domeinnaam), CONCAT('https://www.', @nieuwe_domeinnaam)) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, CONCAT('https://', @oude_domeinnaam), CONCAT('https://', @nieuwe_domeinnaam));
UPDATE wp_posts SET guid = replace(guid, CONCAT('https://www.', @oude_domeinnaam), CONCAT('https://www.', @nieuwe_domeinnaam));
UPDATE wp_posts SET post_content = replace(post_content, CONCAT('https://', @oude_domeinnaam), CONCAT('https://', @nieuwe_domeinnaam));
UPDATE wp_posts SET post_content = replace(post_conte
UPDATE wp_postmeta SET meta_value = replace(meta_value, CONCAT('https://', @oude_domeinnaam), CONCAT('https://', @nieuwe_domeinnaam));
UPDATE wp_postmeta SET meta_value = replace(meta_value, CONCAT('https://www.', @oude_domeinnaam), CONCAT('https://www.', @nieuwe_domeinnaam));
Before the command can be executed, you need to change a few words:
- Replace 'oud-domein.nl' with the old domain name.
- Replace 'nieuw-domein.nl' with the new domain name.
It is important that you execute all queries (lines) at once. So paste everything into the text field.
- Then click "start" to execute the command.
Are you using plugins in WordPress?
Pay close attention to whether the compatibility between your new domain name and the plugins is working properly. Just to be sure, check if the .htaccess and user.ini files also point to the new domain name. If they don't, you can easily adjust this by changing the new domain name where necessary where the old domain is currently listed. You can find these files within DirectAdmin and the file manager. Find the public_html folder and the files are located there.
Are you using Elementor?
Then you will also need to change the new domain name here. Log in to your WordPress environment and go to plugins, click on Elementor --> Tools --> Replace URL to adjust it.
The WordPress settings have now been updated to the settings for the new domain. Have fun with the new domain!
There is also another way to change the domain name for the WordPress website. See: https://wordpress.org/support/article/changing-the-site-url/
Are all your links up to date?
It is possible that some links still point to your old installation or domain, with the following plugin you can easily update the links automatically: https://wordpress.org/plugins/go-live-update-urls/
Once you have installed the plugin, you can use it as follows:
All WordPress core tables are selected automatically, you will need these for the replacement.
Next, enter the old and new domain names, note that you only add www. in front of it if the site is only accessible on www. After that, you can click on Update URLs.
Still have questions? Get in touch.