Jump to content

[SOLVED] Redirecting?


mrbuter

Recommended Posts

Hey guys, I recently made a download.php file (i.e. download.php?f=file.extension).

 

Unfortunately I made it AFTER some people have already been directly linking to the files. Is there a way I can make it so hotlinked files go to download.php?f=thenameofthefile ?

 

I only know how to prevent hotlinking with .htaccess files and those aren't advanced enough I don't think.

 

Any ideas?

Link to comment
Share on other sites

I know how to block access through .htaccess but can .htaccess pass the filename (of the file trying to be downloaded) onto the redirect url?

 

Oh also one more thing, I tried limiting the script so that http referer had to be a certain site. However, is there a way to simply limit it to a domain? Because like www.site.com will work but www.site.com/index.php?s=123 won't (etc.).

 

In short it's being too accurate!

Link to comment
Share on other sites

http://www.javascriptkit.com/howto/htaccess10.shtml

 

 

As for redirecting, and passing the file name, you could do something like...

 

RewriteEngine On

RewriteRule ^/downloads/(.*)$ /download\.php\?file=$1

 

That would rewrite things like....

 

http://yoursite.com/downloads/somefile.txt to http://yoursite.com/download.php?file=somefile.txt

 

 

That's entirely pointless though, as it's basically allowing direct access....  Unless you're doing some kind of check in download.php....

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.