the typical solution is RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC] RewriteRule \.(gif)$ site.com/nohotlink.gif [L] Code (markup): but the problem is my image url are like img.php?n=123 Code (markup): if i put RewriteRule \.(php) is blocking all the php not the images any ideas ?