We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30176
    • 99 Posts
    For some reason that I do not quite understand, Google indexed part of my site www.domain.com on the name server ns2.other-domain.com. I am on IIS and using EVO. Friendly URL rewrites are on rewriting the pages to .html. At this point I have .html links on the name server URL in Google search results. I would like to do in essence 301 redirects. I have taken that name server down and set "ns2" up as a subdomain. What is the best way to do what would be "301" redirects on pages that have been rewritten to html and be Google Friendly? Thank you. [ed. note: tmcleroy last edited this post 14 years, 9 months ago.]
      "Remember what Bilbo used to say: It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."
      -J.R.R. Tolkien from The Lord of the Rings
      • 37393
      • 68 Posts
      If i understood you right, why do you wanna redirect old links to new? That would make non-sense, why don´t you just log into your google webmaster tools and requests a review of your site so that your links get updated and the old ones that you want to redirect.
        IntoVPS - VPS hosting service with super-fast response.
        If MODx does not suit your needs then you have a lack of imagination.
        • 33968
        • 863 Posts
        Do you have this in your .htaccess:
        # Rewrite domain.com -> www.domain.com use the following
        RewriteCond %{HTTP_HOST} .
        RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC]
        RewriteRule (.*) http: //www.domain.com/$1 [R=301,L]
        

        I think that would take care of it. (remove the space after http:, this forum forces a link and messes up the code if I write it correctly)

        Any traffic (including Googlebot) arriving on the wrong domains will then be redirected to www.domain.com (301 means 'permanently moved').

        You should also go into your GWT account as suggested above and check your domain and sitemap.xml settings are correct.

        Check also that the new url is showing up on your pages under the <base> tag, in the site_url setting, and also in your Canonical meta tags if you are using them.

        If i understood you right, why do you wanna redirect old links to new?
        Google doesn't respond instantly and could take weeks or even months to update the index with the correct urls. The 301 solution means any traffic arriving on the old url will be redirected to the correct one instantly... and that includes search robots. [ed. note: okyanet last edited this post 14 years, 9 months ago.]
          • 30176
          • 99 Posts
          Thank you,
          HI Lucas, I am on IIS so not using a .htaccess but do have a rewrite rule in an ini file.

          This is what I have in the rewrite rule:

          RewriteRule ^/manager/.* - [L]
          RewriteRule ^/assets/.* - [L]
          RewriteRule ^/(.*).html /index.php?q=$1 [L,QSA]


          So just add your code to this rewrite rule?

          And thank you for the point on adding the Canonical meta tags. Would you apply that to the template for all documents, even those that are indexing properly?

          Just to clarify, I am staying at the same domain I have had for a long time. After 2 years of not touching the DNS settings, last week Google indexed this domain on it's nameserver. I am on a Plesk panel, I have 2 IP's and all 5 domains resolve to these. Since this domain in question is exclusive one of those IP's, somehow Google started to index the site on the nameserver associated with that IP. Had in not been exclusive I do not think this could have happened. The name servers were in the name of my personal domain, different than this domain indexed wrong. About 1/3 of the links have been indexed now with ns2.mypersonaldomain.org rather than www.domain.com.

          I did not have a Google Webmasters Tools account and so just set one up and did the checks you have mentioned. A little new to that aspect. I did not know you could submit this for review, and so I need to find that link, as it does not stand out to me yet. I have had a sitemap, but just now added the sitemap to the GWT account. The site was #1 in the Rankings without GWT, thanks to MODX's fantastic SEO. In Bing and Yahoo which did not index on this link, it is still #1.
            "Remember what Bilbo used to say: It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."
            -J.R.R. Tolkien from The Lord of the Rings
            • 33968
            • 863 Posts
            Hi there - I'm not sure how those rewrite rules will translate over to IIS but you could always just try it out smiley

            I'd use a Canonical tag in all documents, that way Google will always know which is the 'correct' version of a page. It it arrives on ns2.domain.com but the canonical url says www.domain.com, it will know to index the www version.

            In GWT you can specify the preferred domain name for your site too (domain.com or www.domain.com) which should take care of that for you. Just be a little patient and eventually you should find the correct urls showing up in the search results.
              • 30176
              • 99 Posts
              Thanks to the reply here there was some clarity of direction. Just to let others know how this was handled, the links are coming back fairly quickly and back on the 1st search page. (Note, this only happened in Google; Bing and Yahoo were not affected at all)

              First in the Domain (domain.com) that was hijacked by my nameserver, added in the head section of the template:
              <link rel="canonical" href="[(site_url)][*id:isnot=`[(site_start)]`:then=`[~[*id*]~]`*]" />


              Then added a RedirectRule. Though you probably could filter the redirect on requests coming for ns2.other-domain.org in domain.com's rewrite rules, I just added a new subdomain at ns2.other-domain.org and placed a rewrite file there with the following line:
              RedirectRule ^/(.*)$ http ://www.domain.com/$1 [R=301]


              Note (remove) the extra space after the http in the code. Have to do this so that the blog does not treat this as a link.



              [ed. note: tmcleroy last edited this post 14 years, 9 months ago.]
                "Remember what Bilbo used to say: It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."
                -J.R.R. Tolkien from The Lord of the Rings