Welcome to WebmasterWorld Guest from 188.8.131.52
Wonder is anyone can help me with this, I know its a common problem (seen it mentioned here a few times) and have searched many similar posts but I don't know enough about it to apply to my problem, I spent most of yesterday working on this, driving me mad now!
I have a .htaccess file which creates a clean url like this:
RewriteRule ^widgetdetails/([^/]+)/([^/]+)/?$ wdgetdetails.php?state=$1&color=$2 [L]
So my url:
site.com/wigitdetails/NC/Red/ sends params NC and Red to widgetdetails.php
This works fine, only problem is the URL:
site.com/wigitdetails/NC/Red (note lack of forward slash on the end) also works - duplicate page!.
What I want to do is 301 redirect the latter to have a slash on the end (or any work around if thats not possible).
I have tried many combinations, such as having an extra line of:
RewriteRule ^widgetdetails/([^/]+)/([^/]+)?$ widgetdetails/$1/$2/ R=301,N] (many combinations of various N,R,L,etc flags and position in the .htaccess file) but it either doesn't work or produces 'page not found'.
Anyone any ideas?
RewriteRule ^widgetdetails/([^/]+)/([^/]+)$ http://www.example.com/widgetdetails/$1/$2/ [R=301,L]
RewriteRule ^widgetdetails/([^/]+)/([^/]+[b])/$[/b] /widgetdetails.php?state=$1&color=$2 [L]