How to Configure WordPress to Work with a New Domain
Using WordPress Admin Dashboard
First, go to Settings > General and replace your WordPress Address and Site Address with your new domain name.
- The “Site Address (URL)” The address your visitor must provide in their browser to access your WordPress blog is the setting.
- The “WordPress Address (URL)” setting is the location of the main WordPress files.
Using File Transfer Protocol (FTP)
You can get your site back up and running quickly with wp-config.php and functions.php although you accidentally changed the values incorrectly in the WordPress Dashboard if you have FTP access to the website.
Edit wp-config.php
You can set the URL for your site manually in the wp-config.php file.
Add these lines to your wp-config.php, where “example.com” is the correct location of your site.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Note: Simply hardcoding the data into the website’s source code is not necessarily the best answer. You can no longer modify them on the general settings page when using this technique.
Edit functions.php
- Download a copy of the functions.php file for the current theme. You may update it in a basic text editor and upload it again to the website.
- Add these lines to the file, right after the initial “<?php” line.
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Note: Remember to replace the example.com with your own URL .
3. Re-upload the file to your site in the same location.
4. Load the login or admin page for a few times. The site is supposed to return.