Jean-Luc, just to make sure I am reading your rules correctly:
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ #you are testing for the proper domain
RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301] #You are sending the user to the correct domain
RewriteRule ^f\/ - [L] #If the user is already in the f folder, you stop redirecting
RewriteRule ^(.*)$ http://www.mysite.com/f/$1 [L,R=301] #Otherwise you send the user to the f directory
If that is correct, I see a potential problem. If somehow the www. gets dropped from an otherwise valid link, the user will get an extra /f/ directory. In other words, a request to domain.com/f/page.html would redirect to
www.domain.com/f/f/page.html. I would remove the /f from the second line, separate detection of the subdomain from detection of the folder.