0

I have the typical mod_rewrite rules to make urls prettier

RewriteRule ^most-viewed$ index.php?time=1
RewriteRule ^most-viewed-week$ index.php?time=2

But somehow, Google managed to get the index.php?time= version too, so now, in google search results both results show, the one with the mod_rewrite url, and the "regular" one.

I'm afraid this is bad for seo as this could be considered as "duplicate content".

How can I avoid the "regular" one being indexed, or even better, to make it unaccessible to everyone.

I use PHP if that helps.

Aleix
  • 489
  • 5
  • 16
  • possible duplicate of [htaccess mod_rewrite no duplicate content](http://stackoverflow.com/q/8292502/), [Hide “duplicate content” from Google after using mod_rewrite to remove .php file extension](http://stackoverflow.com/q/8706717/), [Simple mod rewrite with no duplicate urls. It is possible?](http://stackoverflow.com/q/5700031/). See also [Redirect *.php to clean URL](http://stackoverflow.com/a/2267507/), [Pretty URLs Vs. Duplicate Content](http://stackoverflow.com/q/4194210/). – outis Jun 07 '12 at 05:35

2 Answers2

0

You can return a Forbidden or Gone response for anyone directly accessing that.

RewriteRule ^index.php\?time=(1|2)$ [F,L]

.. tells it to return a '403 Forbidden' and end.

You should also include as standard a canonical meta tag:

<link rel="canonical" href="http://yourdomain.com/most-viewed" />

Also check out:

http://googlewebmastercentral.blogspot.com.au/2009/02/specify-your-canonical.html

EDITED Escaped the ?time= part..

Sp4cecat
  • 991
  • 1
  • 8
  • 18
  • That doesn't seem to do anything, if I take out the ?time=(1|2) then it works, but it doesn't seem to do anything if the variable is there. – Aleix Jun 07 '12 at 04:43
  • Sorry, Tebb, the ?time= should be escaped like \?time= I have amended my response – Sp4cecat Jun 12 '12 at 01:01
0

Try to bypass the URL rewriting problem with Google Webmaster Tools and ignore it with "URL Parameters". You can find it under Dashboard> Configuration

Menashe Avramov
  • 386
  • 2
  • 7