Jump to content

Recommended Posts

I've got some free downloads on my site and I want to stop people from downloading them without going through the correct page.

Basically all of my downloads are in a directory like so:

root/downloads/download category/files

 

I want to stop people from just typing the url of a file into there browser and having the file.

I've got a file which counts how many people have downloaded files and re-directs them to the download file. I want this to be the only way someone can access the files.

 

Any ideas?

Thanks

some servers have an option in Cpanel(if they have Cpanel) where you can set redirects for different pages, and you can also password protect pages. But if you don't have Cpanel then I can't really think of anything, besides using mod_rewrite in Apache to simplify your URLs and making it hard for people to try and reach pages by simply changing the URL.

 

hope this helps  :D

 

Regards ACE

thanks.

I've had a look at it, but I'm not sure how I'd implement it into downloadable files.

If I had an index.php file in each download directory, I could probably have a check if a variable has been set, if not then re-direct to another page, but that won't stop people from accessing a file directly.

 

 

EDIT: Just thought. If I used .htaccess to re-direct all users who go to the downloads directory to the index.php, then use index.php to check where they've come from. If they've got a certain variable set them download the file, if not send them to another page...

something like that should work.

I'll have a twiddle and let you know!

ok, I know absolutely nothing about .htaccess lol, but what you suggest may just work, I was also thinking that you could put the index pages in each directory and have a if and else statement, the if statement checks if they got to the page from the form or whatever you have that is suppose to let them download the file, and if not then the else statement kicks in with header("Location: http://www.yourwebsite.com/"); and stops them from getting the files by redirecting back to your sites main page or where ever.

 

ps. i'm off to bed now wont be able to check your post till tommorow afternoon after school, dam i hate school =(

 

Regards ACE

I'm having trouble with this. It's easy enough to re-direct from a php file, but I'm needing to stop people from directly accessing my files by typing the address in the url bar.

I've got .htaccess set up so all directories without an index file give a 403 forbidden error and hotlinking is dissallowed, but none of that stops someone from typing in the url of a file and getting it.

 

There must be a way without having to resort to .htaccess passwords... I just need to check that anyone viewing anything in a certain directory came from a certain page.

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.