Change the URL of my WordPress site in the wp-config.php file
If you're moving your website to a new server, this method can help you preview the site on a temporary domain without the need to make changes to the database. It will prevent the browser from redirecting to the old server. If your hosting plan doesn't come with a temporary domain, it can be any domain you don't use or a subdomain of a live domain.
- Connect to your hosting with FTP or File Manager.
- In the folder with your WordPress installation, find the wp-config.php file.
- Open the wp-config.php file and find the following line:
/* That's all, stop editing! Happy publishing. */
- Just above this line, add the following code:
define('WP_HOME','http://yourdomain.com'); define('WP_SITEURL','http://yourdomain.com');
- Replace http://yourdomain.com with your temporary domain.
- Save the file.
- (Optional) If you're using FileZilla, accept the overwrite warning in FileZilla to replace the file.
You can now visit your temporary domain in a browser and preview the website.
More info
- Here's how to add a subdomain in Linux Hosting with cPanel and Windows Hosting with Plesk.
- Migrate my WordPress site manually
- Migrate my website in GoDaddy Pro to another server. This option is free for all GoDaddy-hosted sites.