mod_rewrite and Google

Discussion in 'Site & Server Administration' started by lopes, Aug 25, 2009.

  1. #1
    Hello, I created rules in my .htaccess file like this:

    RewriteRule ^blog/?$ index.php?page=blog

    So someone visists http://www.mysite.com/blog, he will actually be seeing http://www.mysite.com/index.php?page=blog.

    But there's a problem, Google is indexing both versions of the URLs, and I don't want the "php" URLs to be available.

    So how do I block the undesired URLs, both for Google and the visitors?
     
    lopes, Aug 25, 2009 IP
  2. GNetCoder

    GNetCoder Peon

    Messages:
    68
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Google should not find it unless there is a link to it somewhere in your site. Check any sitemaps you may have created with old links, or other pages in your site using the wrong URL.

    If google insists on indexing it, you can use .htaccess to do a redirect from the old to the new, or use google.com/webmasters to have the URL removed.
     
    GNetCoder, Aug 25, 2009 IP
  3. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #3
    Yes you must have linked it somewhere thats the reason its showing on google.
     
    Bohra, Aug 26, 2009 IP