RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://www\.example\.com [NC] RewriteRule (.*) http://www.example.com/custompage.php [R]