WordPress Tutorial: Change WordPress Site URL

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:

  1. From the cPanel open the File Manager”
  2. Locate and open the directory public_html
  3. Backup your current wp-config.php file before making any changes
  4. Open the wp-config.php  file to edit by clicking the “Edit” button from the “File Manager” menu
  5. 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');
  6. Save the changes to “wp-config.php” file
  7. From the cPanel Go to the “Redirects” under the “DOMAINS” 
  8. Add a permanent redirect from “http://tutorial.kaysariqbal.com” to the “http://www.tutorial.kaysariqbal.com” with the option “Do Not Redirect www.”
  9. From cPanel go to the WordPress
  10. Select the “Edit” under “Options”  to the desired site link
  11. Change the URL to “http://www.tutorial.kaysariqbal.com
  12. Done all things required; time to surf the site with new URL. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.