Question: In my website I have the following categories url structure:

`/category.php?id=6` (id=6 is for internet category)

My SEO friendly url is like:

```
/category/6/internet/

```

The problem is it can be accessed in any of those forms, and because of that, I'm getting duplicate content on google.

So, I'm wondering how can I fix that.

Should I disallow on `robots.txt` any urls with `?` on it?

If so, how can I properly set it up?

Should I make a redirection "Permanently Moved" on `.htaccess`?

If so, how can I properly set it up?

My actual `.htaccess` for categories is like this:

```
RewriteRule ^category/([^/]*)/([^/]*)/$ category.php?id=$1&name=$2 [L]

```

Answer: 
Or you get rid of the non-SEO url.

* always generate SEO url (you should do that anyway for)
* in category.php check if $\_SERVER['REQUEST\_URI'] is the seo one and if not redirect to it
I would suggest using a canonical link in the document head to ensure Google uses the correct URL. [Google on Rel Canonical](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394).

It's really easy to implement, just post this into the HEAD section of the page.

```
<link rel="canonical" href="/your/url"/>

```

Google treats the canonical link as a 301 redirect, which means you won't have any duplicate content issues. It also means most of the link juice gets passed on (between 90% and 99%). If you used robots.txt or .htaccess , the page that you're blocking off would lose all its SEO value.

Just make sure you do this for every page as it's a page specific rule. Linking to the domain root will effectively mean all your pages are 301 redirecting to the home page.