{"id":208,"date":"2019-04-23T13:45:29","date_gmt":"2019-04-23T13:45:29","guid":{"rendered":"https:\/\/www.smarthost.eu\/blog\/?p=208"},"modified":"2020-05-11T12:21:45","modified_gmt":"2020-05-11T12:21:45","slug":"changing-domain-name-in-wordpress","status":"publish","type":"post","link":"https:\/\/www.smarthost.au\/blog\/changing-domain-name-in-wordpress","title":{"rendered":"Changing domain name in WordPress"},"content":{"rendered":"\n<p class=\"has-text-align-left\">During changing our\ndomain,where we have wordpress to another we meet a problem with\nchanging site url addresses and wordpress&#8217;s addresses which are\nassigned to actual installation. We will show a few ways to edit\nurls.<\/p>\n\n\n\n<p class=\"has-text-align-left\"><strong>Method nr 1<\/strong> \u2013 changing address in cockpit<\/p>\n\n\n\n<p>The first method , that we\nwant to show is changing address by WordPress admin panel.<\/p>\n\n\n\n<p>Warning! This method we need\nto do before changing domain to antoher.<\/p>\n\n\n\n<p>In first step we need to\nlogin to wp admin panel  \/wp-admin . In next step we need to go to\ngeneral settings and find WordPress Adress (URL) and Site Address\n(URL) . In this fields we enter our new domain adress and aftter that\nclicking save changes. After doing that operation we will have a site\nerror 404 because this domain is not added yet but the most important\nis that the links in our database will be corrected to links of our\nnew domain.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"476\" src=\"https:\/\/www.smarthost.eu\/blog\/wp-content\/uploads\/2019\/05\/sposo1-2.png\" alt=\"\" class=\"wp-image-211\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposo1-2.png 779w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposo1-2-300x183.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposo1-2-768x469.png 768w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/figure><\/div>\n\n\n\n<p>Now after adding our site in cpanel <em>\u2192<\/em> Addon Domains and changing Document Root to new catalog we can enjoy our new site at the new address.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"935\" height=\"100\" src=\"https:\/\/www.smarthost.eu\/blog\/wp-content\/uploads\/2019\/05\/sposob1_3.png\" alt=\"\" class=\"wp-image-212\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposob1_3.png 935w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposob1_3-300x32.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposob1_3-768x82.png 768w\" sizes=\"auto, (max-width: 935px) 100vw, 935px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Method nr 2<\/strong> \u2013 Changing links inside our database<\/p>\n\n\n\n<p>Second method , that we want\nto show is changing adressess in database. That&#8217;s sounds complicated\nbut operation is quite simple. In first step we need to find in\ncpanel option Phpmyadmin. In next step we need to find our database\nin left side of page and we clik on it. The list will expand and we\nneed to find table _options . After clicking on the first lines we\nwill see  ,,siteurl,, and ,,home,, and in this fields we enter our\nnew domain address.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"246\" src=\"https:\/\/www.smarthost.eu\/blog\/wp-content\/uploads\/2019\/05\/sposob2-1024x246.png\" alt=\"\" class=\"wp-image-213\" srcset=\"https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposob2-1024x246.png 1024w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposob2-300x72.png 300w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposob2-768x185.png 768w, https:\/\/www.smarthost.au\/blog\/wp-content\/uploads\/2019\/05\/sposob2.png 1110w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>Important!<\/p>\n\n\n\n<p>After that change in  wordpress admin panel we need to go  <br>to  Setting permalinks and  click save changes to rebuild references<\/p>\n\n\n\n<p><strong>Method nr 3<\/strong> \u2013 update_options<\/p>\n\n\n\n<p><br> Next method , that we want to show is using fuction update_opions. Thanks to this fuction we have a pissibility to update\/overwrite settings siteurl and home in database. To do this we need to go to file menager in cpanel and find a catalog where we have our site files and file functions.php (main catalog) . Now we need to right click on this file an choose edit . We need to add after line &lt;?php this lines:<\/p>\n\n\n\n<p>update_option(&#8216;siteurl&#8217;,&#8217;http:\/\/customer-domain.eu&#8217;);<\/p>\n\n\n\n<p>update_option(&#8216;home&#8217;,&#8217;http:\/\/customer-domain.eu&#8217;);<\/p>\n\n\n\n<p>Now save the file and\nrefresh site. The link in database should be overwirited . After that\noperation we need to delete this to lines that we added.<\/p>\n\n\n\n<p>If file functions.php isn&#8217;t\nexist we can create that file and add to it<\/p>\n\n\n\n<p>&lt;?php<\/p>\n\n\n\n<p>update_option(&#8216;siteurl&#8217;,&#8217;http:\/\/customer-domain.eu&#8217;);<\/p>\n\n\n\n<p>update_option(&#8216;home&#8217;,&#8217;http:\/\/customer-domain.eu&#8217;);<\/p>\n\n\n\n<p>?&gt;<\/p>\n\n\n\n<p>After save and refresh our\nsite we need to delete new file that we created a moment ago.<\/p>\n\n\n\n<p><strong>Method nr 4<\/strong> -edit file wp-config<\/p>\n\n\n\n<p>The last   method , that we\nwant to show is edit file wp-config. Like in previous method we need\nto find file wp-config in main catalog of our site and edit it.<\/p>\n\n\n\n<p>We need to go to the last\nline of code and paste this:<\/p>\n\n\n\n<p>define(\u2018WP_HOME\u2019,\n\u2018http:\/\/customer-domain.eu&#8217;);<\/p>\n\n\n\n<p> define(\u2018WP_SITEURL\u2019, \u2018 http:\/\/customer-domain.eu\u2019);<\/p>\n\n\n\n<p>Warning! After this change ther will be no possibility to change address in admin panel (cockpit) of our site. These fields will be grayed out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During changing our domain,where we have wordpress to another we meet a problem with changing site url addresses and wordpress&#8217;s addresses which are assigned to actual installation. We will show a few ways to edit<a class=\"read-more\" href=\"https:\/\/www.smarthost.au\/blog\/changing-domain-name-in-wordpress\">Continue reading<\/a><\/p>\n","protected":false},"author":4,"featured_media":209,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,177,39],"tags":[109,112,110,111,63],"class_list":["post-208","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-domain","category-important","category-wordpress","tag-domain","tag-method","tag-name","tag-turtorial","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts\/208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/comments?post=208"}],"version-history":[{"count":10,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts\/208\/revisions"}],"predecessor-version":[{"id":550,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/posts\/208\/revisions\/550"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/media\/209"}],"wp:attachment":[{"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/media?parent=208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/categories?post=208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.smarthost.au\/blog\/wp-json\/wp\/v2\/tags?post=208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}