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
https://forums.phpfreaks.com/topic/111143-solved-redirecting/
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
https://forums.phpfreaks.com/topic/111143-solved-redirecting/#findComment-570392
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
https://forums.phpfreaks.com/topic/111143-solved-redirecting/#findComment-570397
Share on other sites

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.