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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.