Guides‎ > ‎

Change domain


If you move your WordPress to another URL, your site will stop working. To fix it, follow these steps.

Quick fix

Edit wp-config.php

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

But this disables editing the fields in the admin settings

Proper fix

In your current theme functions.php file, add just after <?php

update_option('siteurl', 'http://example.com');
update_option('home', 'http://example.com');

Then sign into the admin page (it will update the database) and remove these two lines.

Through admin panel

Sign in as admin

Admin > Settings > General
  • Change "WordPress address (URL)"

  • Change "Site address (URL)"

If path changed

Edit .htaccess if your path changed

RewriteBase /new-path/
RewriteRule . /new-path/index.php [L]

More information



Comments