Welcome to WebmasterWorld Guest from 220.127.116.11
What is the test URL? What do you get back from the website?
If I ask for
your rule will likely return
You might want to clarify your requirements.
The key is to not include the trailing comma in the parenthesized pattern match to be back-referenced by $1 :
RewriteRule ^(.+),$ http://www.example.com/$1/ [R=301,L]
your solution worked like a charm.
Actually one of my website started getting lots of 404 hits and the incorrect urls have trailing commas (the one I posted), rest of the url is just fine. I've not been able to locate from where this comma is coming yet but meanwhile I thought to remove the error log at least by adding this rule.
Thanks for your help!
@g1smd, yep, this comma was the only issue at the moment but you may please suggest a better rule if you have any ideas. Thanks mate.
My sites usually fix trailing commas, colons, semi-colons, periods, parentheses, and other such punctuation.
# Externally redirect to remove all invalid trailing characters (often
# the result of punctuation following links posted in forums & blogs)
RewriteRule ^(.+)[^0-9a-z/]$ http://www.example.com/$1/ [NC,R=301,L]