xenoalien Posted March 27, 2009 Share Posted March 27, 2009 Like megaupload rapidshare and others? So that the file is moved to a temp folder for a time or however it is done... thanks in advance. Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/ Share on other sites More sharing options...
Silverado_NL Posted March 27, 2009 Share Posted March 27, 2009 an option would be to have the files outside of your www root so u cannot access it directly, but only through a script that is accessible from the outside,which in turn outputs the file u need. this script could look at the machine accessing the script and denying the file if it is anyone else but your own server. maybe but not sure another option might be to restrict access with apache's mod_rewrite. although im not sure how to do this. Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795343 Share on other sites More sharing options...
thepip3r Posted March 27, 2009 Share Posted March 27, 2009 look into URL rewriting by updating your .htaccess file to prevent hotlinking images, vids, etc: http://surprisehighway.com/blog/2006/02/how_to_prevent_hot_linking_and/ Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795346 Share on other sites More sharing options...
PFMaBiSmAd Posted March 27, 2009 Share Posted March 27, 2009 HTTP_REFERER is easily faked and testing it does not stop hotlinking. Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795351 Share on other sites More sharing options...
xenoalien Posted March 27, 2009 Author Share Posted March 27, 2009 HTTP_REFERER is easily faked and testing it does not stop hotlinking. Could you show me what to write in the .htaccess file? Or how to prevent direct linking? At the moment the directory to the main index.php file does not contain a .htaccess file. However I did put an index.php file in the folder where all the files will be uploaded: http://www.storeupon.com/uploaded to prevent people from seeing all of the files as easily... Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795358 Share on other sites More sharing options...
PFMaBiSmAd Posted March 27, 2009 Share Posted March 27, 2009 A) Either place the files in a folder that is outside of your document root folder, like Silverado_NL posted, or B) If that option is not available and you must use a "public" folder inside of your document root folder, place a .htaccess file in the folder with the following - Order Deny,Allow Deny from all Putting a default document in the folder or rewriting the url will prevent someone from seeing the files but it won't prevent someone from linking to them if they find or guess the file names. Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795360 Share on other sites More sharing options...
xenoalien Posted March 27, 2009 Author Share Posted March 27, 2009 A) Either place the files in a folder that is outside of your document root folder, like Silverado_NL posted, or B) If that option is not available and you must use a "public" folder inside of your document root folder, place a .htaccess file in the folder with the following - Order Deny,Allow Deny from all Putting a default document in the folder or rewriting the url will prevent someone from seeing the files but it won't prevent someone from linking to them if they find or guess the file names. One last issue. I am trying to make the .htaccess file with a text editor but windows will not allow me to make a file without a file name am I doing this incorrectly? I understand that I need to put the code in the file. Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795364 Share on other sites More sharing options...
xenoalien Posted March 27, 2009 Author Share Posted March 27, 2009 Okay I figured it out: http://www.tomrafteryit.net/creating-an-htaccess-file/ Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795369 Share on other sites More sharing options...
corbin Posted March 27, 2009 Share Posted March 27, 2009 The way I make .htaccess files is to just put ".htaccess" in the name box (with the quotes). Link to comment https://forums.phpfreaks.com/topic/151415-how-do-i-prevent-direct-file-linking/#findComment-795373 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.