RewriteCond %{QUERY_STRING} ^fm\_dir\=(.*)$
RewriteRule index\.php$ /%1? [NE,N]
# as long as there are two or more slashes,
# replace only one and keep looping internally
RewriteRule ^(.*)\%2F(.*)\%2F(.*) $1/$2\%2F$3 [NE,N]
# when there is only one left,
# replace that last one and send redirect to the client
RewriteRule ^(.*)\%2F(.*) $1/$2 [L,R=302]