We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.13.1.8. Change site url in WordPress

The article describes ways to change the site address only within WordPress itself. To rename a hosting site (virtual host in the section "My sites»And the site directory on FTP), use instruction.

Important points:

  • If the old or new address contains symbols of the national alphabet (for example, Cyrillic), it must be converted to panicode via converter.
  • Installed in site settings redirect on HTTP / HTTPS must match the protocol in the new address. For example, if the site connected certificate and the redirect to HTTPS is set in the site settings, then the new address must start with https://... In case of a protocol mismatch on the site, a cyclic redirect between protocols may occur http:// and https://.
  • Installed in site settings redirect to address from www or without www must match the new address. For example, if a redirect to an address from www is set in the site settings, then the new address must also be from www. In case of protocol mismatch on the site, a cyclic redirect may occur between the address with www and without www.

To change the site url using database queries:

  1. In the site config file takealook the name of the database to which it is connected.
  2. Openup database in phpMyAdmin.
  3. Execute the following three SQL queries:
    UPDATE wp_options SET option_value = REPLACE(option_value, 'http://old_domain.com', 'http://new_domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE wp_posts SET guid = REPLACE(guid, 'http://old_domain.com','http://new_domain.com');
    UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://old_domain.com', 'http://new_domain.com');
  4. To change the site address in the metadata, you should additionally execute one more request:
    UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://old_domain.com','http://new_domain.com');
  5. If the site uses comments, you should additionally execute two more requests:
    UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'http://old_domain.com', 'http://new_domain.com');
    UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'http://old_domain.com', 'http://new_domain.com');
  6. Check the work of the site at the new address.
To change the site url through the WordPress admin panel:
  1. Openup Adminpanel WordPress.
  2. Go to the section "Settings → Arecommon».
  3. Enter the new address in the fields "WordPress address (URL)"And"Website address (URL)". The address must start with a protocol http:// or https:// and there should not be a slash at the end /... An example of a valid address: http://example.com.
  4. Click "Save changes».
  5. Check the work of the site at the new address.

To change the site address using the WP-CLI utility:

  1. Connect to hosting via SSH and install utility, if it has not been previously installed.
  2. Go to root directory site by running the command:
    cd ~/example.com/www

    In the team instead of example.com/www enter your details.

  3. Replace the site address in its database by running the command:
    wp search-replace 'old-address.com' 'new-address.com'

    In the team instead of old-address.com specify the old site address instead of new-address.com - new.
    As a result of executing the command, information about where and how many replacements were made will be displayed.

  4. Check the work of the site at the new address.

You can customize search with replacement more subtly (for example, only for certain tables or columns) using additional attributes described in documentation.