RewriteEngine on
RewriteCond %{HTTP_REFERER} != [OR]
RewriteCond %{HTTP_HOST} !=http://acces.*
RewriteCond %{HTTP_REFERER} !=.*acces.*
RewriteRule ^(.+).rar$ /cgi-bin/download.cgi?$1.rar [NS,R]
---------------------------------------------
Intended is this :
Every RAR file downlaod is rewritten to be pumped through a cgi-script (download.cgi).
That script checks for a cookie, if that cookie exists it prints "Location : http://www.host.com/file.rar"
Which is basialy redirecting. Now comes the problem, this url has RAR so it is rewritten by mod_rewrite again, pumped through download.cgi which redirects it again..etc..
I tried to have the script redirect to access.host.com and setting the mod_reqrite condition to stop when {HTTP_HOST} !=http://acces.* but this doesn't work (can't explain why)
Is anybody able to help me here ?