Ways to change website domain names on WordPress
Whether it is to find a better new domain name or an existing domain name for temporary use, if you do not know how to change a new domain for a website on WordPress, this is the way for you. Note that before changing, you will need to take some action to ensure the security of the posted content.
Prepare the necessary information
Before renaming the website domain, you need to have the following information:
- WordPress login information including username (or email) and password.
- Login information cPanel or file manager.
- FTP login information.
- Access to PHPmyAdmin on the control panel.
Don't forget to back up all settings on WordPress. Here are 4 ways to change domain names for WordPress websites. The first two ways will be easier, if not effective, then the second way.
1. Change domain names on the admin panel of WordPress
This is the simplest way to change domain names for your WordPress website. Just log in to your WordPress account, then go to the General Settings page , you will see two options: WordPress Address (URL) and Site Address (URL).
Change these two URLs to the domain you want, in most cases they will be the same. But they will be different if you store WordPress files on a different directory than the domain used to access the site. In that case, WordPress Address is the directory where the WordPress file is stored, and Site Address is the address that others use to find your site.
If you can access the admin panel, this will work, otherwise try the second method.
2. Edit the database via PHPmyAdmin
Before editing, remember to back up on cPanel or any other control panel you are using. Go to PHPmyAdmin and find WordPress data in the left column. Click to select, you will see the list of tables appear under the name of the database. Find the table named wp_options and click on it. This table contains 2 lines that you need to fix: siteurl and home. Now edit the domain you want to use.
3. Edit wp-config.php file
If the above two methods don't work, fix the wp-config.php file directly. You can edit this file inside the file manager or download it to fix it and upload it to the FTP Client. Please correct the two lines of code that define the website URL as shown below.
Replace example.com with the domain name you want to change. This way will change the domain but should only choose when other ways are not possible. When manually editing the wp-config.php file , you have changed the page value on the website and cannot edit these values using the General Settings section of the admin panel.
4. Edit the functions.php file to update the database
This is only a temporary command and should not be used as a long-term solution. Use this method only when all of the above methods are ineffective or you cannot access the website via the front-end. Please add the following two lines of code after the line "
Then upload the edited file to the page and log in to the admin page several times. This operation will update the database. When the page has accepted changes, delete these 2 lines of code from the functions.php file and the database will still update the previous state.
If the WordPress theme does not have the functions.php file, you can create it yourself by wrapping the above two lines of code into the tag php tags as below.
Save the above code as text file and upload to the theme's main directory. Then log in to the admin panel several times and remember to delete this file after the database has been updated.
You should read it
- Add domain authentication authority to WordPress blog
- The best, fastest DNS list of Google, VNPT, FPT, Viettel, Singapore
- Learn about .io domain names
- How to install WordPress locally on ServerPress
- How to choose the best domain name?
- Famous websites have changed domain names before 'being successful'
- Instructions on how to check .vn domain name on VNNIC
- Turn on / off concurrent connections to both Non-domain network and Domain on Windows 10
- Anyone can now register a .app domain with HTTPS integration
- How to change DNS Quad9 to block malicious domain
- What is Domain Hijacking? How dangerous is it?
- Stories behind .unicorn, .ninja and other strange domain names
Maybe you are interested
390,000 WordPress Accounts Stolen in Large-Scale Attack
How to create WordPress custom fields to add metadata
How to clear WordPress cache
10 Best Website Builders for WordPress
How to use Net Writer to write blogs on Windows 10 - WordPress and Google Blogger support
8 key differences between WordPress and Shopify