How to change your website address on WordPress?
From this article you will learn how to change your domain wordpress
Change of address of our website (domain) based on the system WordPress is despite its simplicity one of the most common activities that cause problems for users. ChangesChanging the address of a website can be done in several different ways, but if it is not done properly, you may lose access and functionality of your website. In the following article, we will describe several ways by which you can change the address of your website without problemthat one.
Change of wordpress domain
For the purposes of the following article, we assume that:
- Website was placed on the server,
- The correct DNS for the domain has been set,
- The database has been imported,
- The only problem left to solve is changing the website address.
- Our old domain is: staradomena.pl and new one is: nowadomena.pl
You should also remember to before make a backup copy of any interference in the code of the website or in the database.
Method 1 - Change the page address by editing the file wp-config.php
The first way we will present is to edit the configuration file WordPress. To change address of the website, it is enough to edit the file using an FTP client config.php, which is located in the root directory of the website. Then go to the last line and paste the code below:
WordPress subpage address change
define('WP_HOME', 'http://nowadomena.pl'); define('WP_SITEURL', 'http://nowadomena.pl');
This solution will allow us to change the URL of our page by defining in the configuration file specific address. The only disadvantage of this solution is the inability to change the address in panel administrative.
Method 2: We edit the data in the database
Similarly simple way as the previous one. In order to change address of the page we should log into phpMyAdmin, find table, where our settings are stored (by default wp_options) and find two values: 'siteurl' and 'home', to make it easier to find these fields it is a good idea to type 'http' in 'filter rows'.
The whole operation consists of replacing the old address with the new one, using the option Edit.
Method 3: Using the function update_options
The third way we would like to present is update settings, by using the update_options. This feature allows you to overwrite your database settings without having to log in and change 'siteurl' and 'home' values via phpMyAdmin. In order to do that using FTP client you have to edit file functions.phpwhich is located in the main directory of our website template, and then right after the add the following code:
update_option('siteurl', 'http://nowadomena.pl'); update_option('home', 'http://nowadomena.pl');
After saving the changes, refresh pagesand the settings will be overwritten. After the script is successfully executed, remove the above code from the file functions.php.
NOTE! In the event that your template does not have the file functions.php, create a new file and add the following code to it:
After uploading the file to the server and refreshing the page main The site address should be changed and the file should be removed from the server.
Bonus: Way 4. Change before moving the site
Going beyond our initial assumptions, we can do a site address change through Cockpit. All you need to do before changing the address and moving the page is to upload a plugin Automatic Domain Changer. Plugin that allows you to change all addresses URLs found in our database. Also those found in entries.
Presented via us ways allow you to easily and smoothly change the domain and URL of our website. Before doing any of them, we advise you to always make a backup of the files and settings contained in the database.
Internal Links and Sematics
Link building has never been easier. Hundreds of link possibilities in one click.
Professional SEO platform
SEMrush offers solutions for SEO, PPC, content, social media and competitive research.