If it doesn't work with subdomains, the rule is located in the wrong place. But from your example it's impossible to tell whether the rewrites, as a whole, are just in the wrong htaccess file / wrong directory, or whether they're too far down the mod_rewrite list, after requests for subdomains have already been intercepted.
Since you've got an [L] functioning as an access-control rule (much like the common anti-hotlinking functions), you need to place it together with any RewriteRules that end in the [F] flag.
Incidentally you don't need the full
^http://(.+\.)?example\.com
(an awful format anyway, since it initially matches ALL referers) All you need is
semalt\.com
without opening anchor.
Edit: Yup, we all know semalt. My own rule uses mod_setenvif so it can be shared by all domains using the same htaccess.
[edited by: Ocean10000 at 6:54 pm (utc) on Aug 24, 2014]
[edit reason] Fixed Typo [/edit]