.*//.*
I'm surprised g1 hasn't swung by to throw a fit about that leading .* yet :)
.* doesn't mean "non-slash", it means "anything in the world, so long as there are at least two slashes after it". So it would match
abc///////////////def
but only the final slash in that long string would go away.
The icky messy part is the first one in the OP:
www.example.com//morestuff
because you can't be sure what will come through in your htaccess. (Long exhausting discussions elsewhere in these Forums having to do with presence or absence of leading slash.)
You can write htaccess rules for a single occurrence of //+ but if you're getting requests with lots of multi-slashes, it's either php-script time or resign yourself to multiple Redirects.
Insert quote from Mae West about lesser of two evils.
Here's my entirely different version. I used .com in the Condition as a stand-in for whatever your domain name really ends in. You need it so you can avoid the one place where there are
supposed to be two // slashes-- without having to spell out the whole tedious Request.
RewriteCond %{THE_REQUEST} \.com/((?:[^/\ ]+/)*)/+((?:[^/\ ]+/)*[^/\ ]*)
RewriteRule (^/|//) http://www.example.com/%1%2 [R=301,L]
If it turns out that everything is hitting your htaccess with leading slash, get rid of that side of the Rule and reduce it to // alone.
The leading slash as in www.example.com// is not a serious worry anyway, unless g### picks it up and starts yattering about Duplicate Content. Unlike multi-slashes deeper into the URL, it will simply be ignored and treated as a single slash. (I know this because by pure coincidence I recently had a request in this form, and had to figure out why my log-wrangling routine missed 60-odd illustrations that it should have ignored.)