{"id":105,"date":"2009-04-01T12:45:04","date_gmt":"2009-04-01T19:45:04","guid":{"rendered":"http:\/\/www.zulutown.com\/blog\/?p=105"},"modified":"2009-04-01T12:45:04","modified_gmt":"2009-04-01T19:45:04","slug":"change-your-site-domain-or-path-keeping-your-google-pagerank-and-position","status":"publish","type":"post","link":"https:\/\/www.zulutown.com\/blog\/2009\/04\/01\/change-your-site-domain-or-path-keeping-your-google-pagerank-and-position\/","title":{"rendered":"Change your site domain or path keeping your Google PageRank and position"},"content":{"rendered":"<p>When a website moves from an URL to another, the main issue for the webmaster is try to keep a good position on the Google search results (or other search engines).<br \/>\nTime ago I applied the <strong>SEO technique<\/strong> described in this article and I obtained good results.<\/p>\n<p>The goal, in this example, is to move the site located in <code>http:\/\/www.youroldsite.com\/section\/<\/code> to the new location <code>http:\/\/www.yournewsite.com\/section\/<\/code>.<\/p>\n<p>The trick to map everything  to the new location (without specifying every single URL) and especially to tell correctly to Google to consider that the site has moved (as described in Google FAQ) is to use the HTTP response code <em>301<\/em> that causes a <strong>Permanent Redirect<\/strong>.<\/p>\n<p>Obviously everything inside the <code>section<\/code> directory must keep exactly its previous relative path. I.e. <code>http:\/\/www.youroldsite.com\/section\/page.html<\/code> have to be placed in <code>http:\/\/www.yournewsite.com\/section\/page.html<\/code>.<br \/>\nIt&#8217;s even possible, using regular expression, to map relative paths that have some differences, but a &#8220;logic&#8221; between them should exist.<\/p>\n<p>A <code>.htaccess<\/code> file should be placed inside the <em>document root<\/em> or in the <code>section<\/code> subdirectory of the <strong>old<\/strong> website where the site is moving out<br \/>\nThe content of <code>.htaccess<\/code> should look like this:<\/p>\n<pre>RedirectMatch 301 ^\/section\/(.*)$ http:\/\/www.yournewsite.com\/section\/$1<\/pre>\n<p>Obviously if the new site has <code>section<\/code> moved in <code>othersection<\/code> the <code>.htaccess<\/code> should look like this:<\/p>\n<pre>RedirectMatch 301 ^\/section\/(.*)$ http:\/\/www.yournewsite.com\/othersection\/$1<\/pre>\n<p>And if the relocation has happened within the same domain:<\/p>\n<pre>RedirectMatch 301 ^\/section\/(.*)$ \/othersection\/$1<\/pre>\n<p>A test made with <code>wget<\/code> (a GNU tool):<\/p>\n<pre>Connecting to www.youroldsite.com|127.0.0.1|:80... connected.\r\nHTTP request sent, awaiting response... 301 Moved Permanently\r\nLocation: http:\/\/www.yournewsite.com\/section\/ [following]\r\n--2009-03-24 20:04:59--  http:\/\/www.yournewsite.com\/section\/\r\nResolving www.yournewsite.com... 127.0.0.1\r\nConnecting to www.yournewsite.com|127.0.0.1|:80... connected.\r\nHTTP request sent, awaiting response... 200 OK<\/pre>\n<p>I applied the first configuration to one of my websites that was in the first position on Google for some <em>query strings<\/em>, because unluckily I had to move it on a new domain name.<\/p>\n<p>The result has been very good. After 7 days I placed the <em>Redirect 301<\/em>, my old URL (that was the first position of Google) has been replaced by the new one. Still in the <strong>first position<\/strong>, and it&#8217;s still there!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When a website moves from an URL to another, the main issue for the webmaster is try to keep a good position on the Google search results (or other search engines). Time ago I applied the SEO technique described in &hellip; <a href=\"https:\/\/www.zulutown.com\/blog\/2009\/04\/01\/change-your-site-domain-or-path-keeping-your-google-pagerank-and-position\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,82,83],"tags":[94,92,98,172,99,101,91,88,89,100,90,102,87,95,96,93,86,85,173,84,97],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-apache","category-google","category-seo","tag-htaccess","tag-92","tag-domain-name","tag-google","tag-google-first-position","tag-google-pr","tag-http-301","tag-location","tag-moved","tag-pagerank","tag-permanent-redirect","tag-pr","tag-redirect","tag-redirectmatch","tag-regular-expression","tag-relative-path","tag-relocate","tag-search-engine","tag-seo","tag-url","tag-wget"],"_links":{"self":[{"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":5,"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/posts\/105\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zulutown.com\/blog\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}