Change site url and home url of WordPress website

Change site url and home url of WordPress website

Sometimes it happens that you have to change the site url of a WordPress website, for example after a move. There are different ways to do this. No matter which way you choose, you should first create a backup of the file, the database or the entire system.

What is the site url?

The site url is also known as the WordPress url. It is the url that leads to your WordPress installation. If you installed WordPress in its own folder, for example in the folder wordpressthen your site url is http://www.deine-adresse.de/wordpress.

What is the home url?

The home url is the url that your visitors enter in the address line to get to your website, for example http://www.your-address.de. Sometimes it is also called blog url. The home url and the site url are mostly the same. If you installed WordPress in a subfolder, they will differ from each other.

Change the site url of a WordPress website via wp-config.php

In this variant, the wp-config.php processed. You can find this in the main directory of the WordPress installation. You can edit the file with an editor such as Open Sublime Text, Notepad++ etc. Now add these two lines.

define('WP_SITEURL', 'http://www.neue-adresse.de');
define('WP_HOME', 'http://www.neue-adresse.de');

I always add the two lines after.

/* Das war’s, Schluss mit dem Bearbeiten! Viel Spaß beim Bloggen. */
/* That's all, stop editing! Happy blogging. */

The urls overwrite the urls in the database or those entered in the backend.

Change the site url of the WordPress website via relocate

In this variant, too, the wp-config.php opened and edited. To do this, enter the following line (note: it should not be at the very beginning or end of the file):

define('RELOCATE', true);

After that you have to wp-login.php on your WordPress website at www.domain.de/wp-login.php. Before you log in, you must enter the constant RELOCATE delete again from the wp-config.php. Then you log in via the called wp-login.php into your website. If you are logged in, you will find under

Einstellungen -> Allgemein -> WordPress-Adresse (URL)

the new url to your WordPress website.

Change the site url of the WordPress website in the database

If you want to change the URL directly in the database, you need access to the phpMyAdmin area of ​​your database.

If you are logged in, you will see all tables that are used. We are looking for the table wp_options.

The table name may differ slightly if you chose a different table prefix during installation. Open the table wp_optionssearch in the column option_name the siteurl.

Now you can click on the icon for “edit” and in the column option_value enter the new url.

After you click save, you should be back in the spreadsheet wp_options go and after home search and change the url there as well.

Change WordPress website site url with Migrate DB

Another alternative that I love to choose is the help of a plugin called Migrate DB. With the plugin you can very easily replace the urls and paths in the entire database – even in serialized arrays.

After installing the plugin, you will find under

Werkzeuge -> Migrate DB

the settings. With replace you insert the new domain and the new path, click on export and you have created a dump of the entire database with the changed urls and paths.

Now log into the phpMyAdmin area of ​​your database, select the database and import the created dump. You can then deactivate and delete the plugin again. That was all.

If you need help with this, please contact us. Preferably by email to kontakt@wp-bibel.de. We are happy to support you here.

Previous post How to make your WordPress site web accessibility ready?
8 free plugins for any WordPress website Next post 8 free plugins for any WordPress website