Change wordpress site URL

From Notes_Wiki
Revision as of 14:43, 28 July 2022 by Saurabh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Home > CentOS > CentOS 6.x > Web based tools or applications > Wordpress configuration > Change wordpress site URL

In a working wordpress site /wp-admin can help in changing site URL. However if a wordpress site is no longer functioning because site URL has changed then use following steps to change wordpress site URL use:

  1. Edit wp-config.php and append
    define('WP_HOME','http://example.com');
    define('WP_SITEURL','http://example.com');
    Note that this is not ideal as this fixes the site URL and later this cannot be changed via settings page. Updating wp_options database table option_name siteurl and home is better.
  2. Search for old URL everywhere using 'grep -r old-url *' and replace using
    find . -type f -exec sed -i "s/old-url/new-url/g" '{}' \;
    in all sub-folders and files recursively.

Refer https://codex.wordpress.org/Changing_The_Site_URL


Home > CentOS > CentOS 6.x > Web based tools or applications > Wordpress configuration > Change wordpress site URL