Hi everyone,
I've been banging my head against this issue for ages now and I'm out of ideas. I've got a Magento site with lots of CMS and lots of directory layers similar to this:
http://www.domain.com/category/subcategory/product-information/
I'm not sure if my problem is related to the use of several layers of directories or not but I'm either getting redirect loops or nothing is happening at all.
Basically these two pages will look like duplicate content to Google:
http://www.domain.com/category/subcategory/product-information
http://www.domain.com/category/subcategory/product-information/
I want to force a slash but each time I find some code for the .htaccess file, I'm finding it doesn't have any effect.
So far:
1. I've tried this code which seems to do nothing:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
#Force Trailing slash
RewriteRule ^((.*)[^/])$ $1/ [L,R=301]
</IfModule>
2. I've tried this code for each possible url which seems to produce a redirect loop adding several slashes to the end of the URL:
redirect 301 /category/subcategory/product-information http://www.domain.com/category/subcategory/product-information/
3. I've tried excluding the non-slash url in the robots.txt file as below but this ended up excluding any urls in that directory tree when I examined the site using Screaming Frog:
Disallow: /category/subcategory/product-information
4. I've searched the URL rewrite DB in magento for similar redirects and I've even emptied it. I've also tried rebuilding it.
I'm sure i'm missing something really stupid and obvious but I've been staring at this screen for far too long now. Can anyone see what I'm doing wrong please?