homepage Welcome to WebmasterWorld Guest from 54.197.183.230
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Making a directory unaccessable other than from the server itself
A file hosting website doesn't want direct viewing of files, only downloads
uplius



 
Msg#: 4066780 posted 2:39 pm on Jan 24, 2010 (gmt 0)

Hi there, I have the file hosting website which I just started. I have it set up that there is a directory called "Files" where all the files are stored, then in a seperate directory there is "download" which contains the files needed to download a file from the files directory. So if you go to foo.com/dl/filename.jpg, it will download the file (using an htaccess shortcut, actual route is foo.com/download/index.php?file=filename.jpg). However, if you accessed this file directly by going to the source of the file, foo.com/files/filename.jpg, then you will be viewing the image. The more primary concern is the viewing of html or php files, I don't want a website hosting site to implant itself! How do I prevent the access of these files ONLY by my download directory, but not in the files directory itself? Thanks!

 

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4066780 posted 3:02 pm on Jan 24, 2010 (gmt 0)

See the documentation for Apache [httpd.apache.org] mod_access and Apache core appropriate to your server version number.

Put a .htaccess file in the /files subdirectory containing

Options -Indexes
#
Order Deny,Allow
Deny from all

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved