{"id":56693,"date":"2023-09-11T15:27:26","date_gmt":"2023-09-11T12:27:26","guid":{"rendered":"https:\/\/tuthost.ua\/faq\/how-do-i-change-the-name-of-my-wordpress-site\/"},"modified":"2024-07-19T19:17:14","modified_gmt":"2024-07-19T16:17:14","slug":"how-do-i-change-the-name-of-my-wordpress-site","status":"publish","type":"ht_kb","link":"https:\/\/tuthost.ua\/en\/faq\/how-do-i-change-the-name-of-my-wordpress-site\/","title":{"rendered":"How do I change the name of my WordPress site?"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\" id=\"&#x432;&#x430;&#x440;&#x438;&#x430;&#x43D;&#x442;-1\">Option 1<\/h4>\n\n<p>You can change the name of the site (domain) using the WP-CLI console utility<\/p>\n\n<p>This will also require ssh access to the server.<\/p>\n\n<p>To change your WordPress domain name using WP-CLI (WordPress command line), you will need to follow a few steps. Please create backups before you start.<\/p>\n\n<p>First, navigate to your site directory using the cd command (replacing domain.com with your domain):<\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em>cd domains\/domain.com\/public_html<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n<p>Then run the command to determine the domain name<\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em>wp option get siteurl<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n<p>You can now change the domain name using the search-replace command. Replace old_domain.com with your old domain and new_domain.com with your new domain:<br\/><\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em>wp search-replace &#8216;old_domain.com&#8217; &#8216;new_domain.com&#8217;<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n<p>If your site uses HTTPS, note that you must also enable HTTPS link replacement:<\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em>wp search-replace &#8216;https:\/\/old_domain.com&#8217; &#8216;https:\/\/new_domain.com&#8217;<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n<p>After running the search-replace command, update the site settings to display the new domain. In the WordPress admin panel, go to &#8220;Settings&#8221; &gt; &#8220;General&#8221; and make sure the &#8220;WordPress Address (URL)&#8221; and &#8220;Site Address (URL)&#8221; field contains the new domain.<br\/>After changing your domain, also make sure that all links and resources on your site use the new domain. You may have to manually update some links if they are in the template files.<\/p>\n\n<h4 class=\"wp-block-heading\" id=\"&#x432;&#x430;&#x440;&#x438;&#x430;&#x43D;&#x442;-2\">Option 2<\/h4>\n\n<p>Another option is to change the name of the website address using SQL queries in the phpMyAdmin interface. You can access it through the DirectAdmin hosting control panel. Don&#8217;t forget to back up your base beforehand.<\/p>\n\n<p>In phpMyAdmin, select your site&#8217;s database and click on the <em>&#8220;SQL&#8221;<\/em> link <\/p>\n\n<p>Below is a list of commands to execute by replacing the name of the old and new domain. Also pay attention to the protocol you have specified, http or https.<\/p>\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><em>\/* update all post links *\/<\/em><em>update wp_posts<\/em><em>set guid = REPLACE(guid, &#8216;http:\/\/www.oldsite.com&#8217;, &#8216;http:\/\/www.newsite.com&#8217;)<\/em><em>where guid LIKE &#8216;%http:\/\/www.oldsite.com%&#8217;;<\/em><br\/><em>\/* update all links in post content *\/<\/em><em>update wp_posts<\/em><em>SET post_content = REPLACE(post_content, &#8216;http:\/\/www.oldsite.com&#8217;, &#8216;http:\/\/www.newsite.com&#8217;)<\/em><em>where post_content LIKE &#8216;%http:\/\/www.oldsite.com%&#8217;;<\/em><br\/><em>\/* update all links in the meta *\/<\/em><em>update wp_postmeta<\/em><em>SET meta_value = REPLACE(meta_value, &#8216;http:\/\/www.oldsite.com&#8217;, &#8216;http:\/\/www.newsite.com&#8217;)<\/em><em>where meta_value LIKE &#8216;%http:\/\/www.oldsite.com%&#8217;;<\/em><br\/><em>\/* update options *\/<\/em><em>update wp_options<\/em><em>set option_value = REPLACE(option_value, &#8216;http:\/\/www.oldsite.com&#8217;, &#8216;http:\/\/www.newsite.com&#8217;)<\/em><em>where option_value LIKE &#8216;%http:\/\/www.oldsite.com%&#8217;;<\/em><\/td><\/tr><\/tbody><\/table><\/figure>","protected":false},"excerpt":{"rendered":"<p>Option 1 You can change the name of the site (domain) using the WP-CLI console utility This will also require ssh access to the server. To change your WordPress domain name using WP-CLI (WordPress command line), you will need to follow a few steps. Please create backups before you start. First, navigate to your site&#8230;<\/p>\n","protected":false},"author":13,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","ghostkit_customizer_options":"","ghostkit_custom_css":"","ghostkit_custom_js_head":"","ghostkit_custom_js_foot":"","ghostkit_typography":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"ht-kb-category":[10779],"ht-kb-tag":[],"class_list":["post-56693","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-wordpress-en"],"taxonomy_info":{"ht_kb_category":[{"value":10779,"label":"Wordpress"}]},"featured_image_src_large":[],"author_info":{"display_name":"\u0414\u0430\u0432\u0438\u0434","author_link":"https:\/\/tuthost.ua\/en\/author\/david-tuthost-com\/"},"comment_info":0,"_links":{"self":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb\/56693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/comments?post=56693"}],"version-history":[{"count":1,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb\/56693\/revisions"}],"predecessor-version":[{"id":56694,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb\/56693\/revisions\/56694"}],"wp:attachment":[{"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/media?parent=56693"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb-category?post=56693"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/tuthost.ua\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=56693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}