Jump to content

Help with mod_rewrite, tricky hotlinking problem


Carbunkulous

Recommended Posts

I run the site http://www.willhostforfood, and with the new version hot linking will be gracefully degraded too the download page.. but i'm having a slight problem..

 

I want the page too go back to the download page, even if they type the hotlink directly into the URL bar, only too actually allow them too download if they get redirected through my dl.php script. (It just uses header(location:)) ... is there anything I can do to GRACEFULLY degrade it? I know i could chmod the files low enough and then raise the permissions when the DL button is pressed, but that would stop any hot linkers completely.. I want it too go back to the DL page.

 

My current code consists of:

 

RewriteEngine on

RewriteRule ^files/([0-9])$ /files/$1/*.* [R]

RewriteRule ^files/([0-9])/$ /hotlink.php?Folder=$1

 

the folders are stored in this sort of directory

files/rand(0,1000000)/filename.fileext

 

If it is declared not from the DL page, I want it too redirect too

hotlink.php?Folder=[the rand() part]

From there I can redirect too the DL page, so don't worry about that :)

 

I don't need the actual filename, i just need which folder it is stored in...

 

any help would be appreciated..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.