I've got a problem with a website, and i don't know which code i must use to solve it.
I've run a crawl test, which results in the following structure:
www.domain.com
www.domain.com/ (this is a big problem, because it's duplicate content)
www.domain.com/category
www.domain.com/category/page
www.domain.com/category2
www.domain.com/category2/page
www.domain.com/category3/subcat4/page
etc.
As you can see, the subpages don't have a trailing slash. My question is: What redirect code is the most effective way to solve the duplicate homepage problem? Taken in account, the subpages don't have (so don't need?) a trailing slash.
You could just force a trailing slash with .htaccess Something global would look like this (quick untested code)
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]
You can ofcourse just specify the root, and not use the (.*).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With