RewriteEngine On RewriteCond %{HTTP_REFERER} !^http:\/\/.*\/main-redirect.php [NC] RewriteRule ^/(.*)$ /main-redirect.php?args=$1 [R,QSA]