RewriteCond %{HTTP_REFERER} !^$RewriteCond %{HTTP_REFERER} !^http://([a-z0-9]+).yourdomain.com(.*) [NC] RewriteRule resserver.php?.*$ - [F,NC]