Background:
It might be needed to change WordPress site URL for example from http://domain.com to http://www.domain.com and vice versa.
Workaround:
My test blog’s original site URL was http://tutorial.kaysariqbal.com; intend to prefix the site with www so the site will look like http://www.tutorial.kaysariqbal.com. To make Change WordPress Site URL i had to work on cPanel of the site. There are many ways to change WordPress site URL (read more); i will implement the method of editing the “wp-config.php” file. Steps are below:
- From the cPanel open the “File Manager”
- Locate and open the directory “public_html“
- Backup your current “wp-config.php“ file before making any changes
- Open the “wp-config.php“ file to edit by clicking the “Edit” button from the “File Manager” menu
- Appending the below two lines in the “wp-config.php” file
-
define('WP_HOME','http://www.tutorial.kaysariqbal.com'); define('WP_SITEURL','http://www.tutorial.kaysariqbal.com');
-
- Save the changes to “wp-config.php” file
- From the cPanel Go to the “Redirects” under the “DOMAINS”
- Add a permanent redirect from “http://tutorial.kaysariqbal.com” to the “http://www.tutorial.kaysariqbal.com” with the option “Do Not Redirect www.”
- From cPanel go to the WordPress
- Select the “Edit” under “Options” to the desired site link
- Change the URL to “http://www.tutorial.kaysariqbal.com“
- Done all things required; time to surf the site with new URL. 🙂