XF 2.1 Hotlink Protection on a /data folder?


Well-known member
I'm trying to prevent hotlinking from a very specific folder in my /data directory. Lets call it /data/sba.

Inside /data/sba, I have added an .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpe?g|png)$ http://mydomain.com/files/hotlink.png [NC,R,L]
However, this doesn't appear to be working at all. Any tips?

In my root / I have an htaccess with the following:
Options -ExecCGI

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_headers.c>
    ## Cache Control
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access 1 month"
    ## Compression
    <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
        AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
        AddOutputFilterByType DEFLATE application/javascript application/x-javascript

## Rewrites
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]