I'm migrating a complex old website to a new one coded with codeigniter and i'm facing a lots of rewriting url problems leading to duplicated content because of the way that the codeigniter's routes config works.
I've old urls like this:
- /detail.php?id=ABCDE&lang=en&page=2
- /detail/ABCDE/en/2
The new site instead have seo friendly urls like:
- /en/products/hard-disks-2.html
In my routes config i've:
- $route['(:any)/(:any)/(:any)'] = 'controller/$1/$2/$3';
- $url_suffix is '.html'
This is leading to duplicated content because:
- /en/products/hard-disks-2
- /en/products/hard-disks-2.html
- /en/products/hard-disks-2.html?p=2
- /en/products/hard-disks-2?p=2
- /en/products/hard-disks-2.html/
- /en/products/hard-disks-2.html/.html
all of the above are valid routes for codeigniter and this lead for duplicated content within the website.
Is there a way to avoid this? Maybe using regular expression?
I cannot solve this problem with .htaccess because the website has too many possibile combinaton of the urls and i've also some controller where i still need to use "get" parameters.