Restricting direct access to files and directory listing

Status
Not open for further replies.

Mayuresh Kasture

New Member
Messages
11
Reaction score
0
Points
0
cPanel user name: mayuresh
Domain: mayureshkasture.com
Hosting Package: ad-free hosting

Hi,

I have two queries,

1. How to prevent direct access to files from my public folder.
Say I have a folder called "A" in the "public_html" folder and A contains file called "B.pdf". I want this file to be accessed only through the links that I provide on my website. If somebody tries to access "http://mayureshkasture.com/A/B.pdf", he should not be allowed to do that. I am aware of hotlink protection and I tried that. But when I put "pdf" into the list of extensions to be protected against direct access, links form my website to a pdf document also stopped working. As in they started opening a blank pdf document. (I am using Mozilla Firefox 3).

2. How do I restrict directory listing?
Say I have a folder called "A" in the "public_html" folder and A contains file called "B.pdf". If somebody accesses "http://mayureshkasture.com/A", he will get the list of files in that folder (B.pdf in this case). I want to restrict this listing.

Could you please answer both my queries?

Thanks in advance,
Mayuresh
 

Mayuresh Kasture

New Member
Messages
11
Reaction score
0
Points
0
Hi..

Nice articles, buddy. The website is going into my bookmarks/favourites. :)

But, although following the steps in the articles will solve my problem, can I not set these options using cPanel ? If I can, that would be better since those settings will automatically be applied to new folders that I'll add and I will not have to create htaccess files in each and every folder.

I am pretty sure, you can do this using cPanel. The web hosting service(WSNW - Websites Network), which I used before I came to x10 Hosting, also had cPanel. And there I had done these settings using cPanel. I am just having hard time recollecting what those settings were. :-(

So, if you know how to set these options using cPanel, please let me know.

Thanks,
Mayuresh
 

Mayuresh Kasture

New Member
Messages
11
Reaction score
0
Points
0
Hi Christopher:

I followed the steps given in those articles. Well both my problems are solved. Thanks.

But, following these steps created a problem with pdf files in Firefox 3. Now, when I click on a link(in my website) to a pdf file, a new tab opens with the name of the pdf file as title. But, then status bar shows "stopped" and file contents are not loaded. Where as in IE7, it works perfectly fine.

Can you help me with this?

Thanks,
Mayuresh
 
Status
Not open for further replies.
Top