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

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

Removed the = sign, works. oh my
Guest
 


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 5 guests

cron