There are many reasons why you need to edit the Site URL of your WordPress Website.
- If you migrated your WordPress website
- If you cloned your WordPress website
- If you want to use a preview address for your WordPress website. (How comes you need to use a preview address? Let’s say you are a web developer. Your client has the website “testdomain.com” which is hosted on a third party hosting server. You want to move the domain to your hosting, and create this domain on your hosting server. Since the DNS entries from this domain do not point to your hosting server, you can’t use this domain name for developing. Many hosting providers offer such a preview address. E.g. Plesk preview address. By setting this preview address as Site URL, you can develop the website with this preview address and present your website.)
#1 Edit the WordPress Site URL in wp-config.php file
The easiest way is to customize the wp-config.php
file. To do this, you must have permission on your hosting server. Simply edit the wp-config.php
file on your hosting server dashboard such as cPanel, Plesk. If you don’t have access to it, ask your hosting provider for FTP access. Customization on hosting dashboard (Plesk)Navigate using the “File Manager” item on the left navigation menu. Then click on the wp-config.php
file in the file manager. Add the following line somewhere in this file. Pay attention to the following points:
- Replace the new domain with “YOURDOMAIN.com”.
- If your website doesn’t have an SSL certificate, use “http://” instead of “https://”
define('WP_HOME','https://YOURDOMAIN.com'); define('WP_SITEURL','https://
YOURDOMAIN.com
');
#2 Adjust WordPress site URL in database
If you don’t have access to your hosting server or FTP access, you can replace the WordPress site URL in the database. To do this, you need access to the domain’s database. Either connect with a database client such as HeidiSQL, MySQL or access with PhpMyadmin.
In the database, open the wp_options
table. If you have created your WordPress website with a hosting configuration tool such as Plesk, cPanel, the prefix of “_options” may differ. For example “w23spx_options”.