mod_rewrite looping galore

Oh, the strange things mod_rewrite does!

Postby Guest » Sat Jun 22, 2002 5:17 am

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 :"

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 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 ?

Postby Guest » Sun Jun 23, 2002 12:30 pm

Removed the = sign, works. oh my

Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 1 guest