You can intercept calls on your 404 page and redirect them.
You can access the request with this:
#set ($thispage=$request.getAttribute("javax.servlet.forward.request_uri"))
#set ($len=$thispage.length())
#set ($prev=$math.sub($len,1))
#if ($thispage.substring($prev,$len)=='/')
#set ($fixed=thispage.substring(1,$prev))
$response.sendRedirect($fixed)
#end
Don't trust that code, it's just pseudocode and totally untested. There might be a smarter way to get the last character.
Hrm, maybe this instead - it's not the 'proper' technique but I think it's a lot easier to parse and understand.
#set ($teststring="${thispage}@")
#if ($teststing.contains("\@"))
#set ($fixed=$teststring.replaceAll("\@',''))
Regardless, put this at the very top of your 404 page code because you want that sendRedirect to happen before any HTML output at all.
If you are going this route, tell us your version and we can tell you how to access the 404 page code.
Lastly, I am sure you can fix this in the OS, if you have access (mod_rewrite in Apache, for example) but that's not really a dotCMS question.
Mark Pitely
Marywood University