473,836 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do i protect files in directory from being listed and viewed

luckysanj
69 New Member
I am developing the free e-book sites.so i I want to know how to prevent the subfolders from websites.

Means, when we open the home page like www.best4knowledge.com then it first open index page then it's ok but users may be guess that there will be any folder & open like that www.best4knowledge.com/front/ . & it shows all the files but it is not secure for me to show all files.

So plz guide me how can i prevent to that files from un authentic person.

Thank you.
Jul 31 '09 #1
9 4770
Markus
6,050 Recognized Expert Expert
What server are you using? IIS, Apache?
Jul 31 '09 #2
luckysanj
69 New Member
Apache Server Because i am programming on PHP language.
Jul 31 '09 #3
Niheel
2,456 Recognized Expert Moderator Top Contributor
one way to do this without setting up secure password is to using an apache .htaccess file

Add the following in a file called .htaccess and upload it to the folder called "front"

Expand|Select|Wrap|Line Numbers
  1. <Directory ~ "\.front">
  2. Order allow,deny
  3. Deny from all
  4. </Directory>
  5.  
The other way to do this is setup a username and then password protect the folder. You'll find an easy to follow howto with complete directions and tools at this url:
http://www.ilisys.com.au/support/lin...sword-protect/
Jul 31 '09 #4
luckysanj
69 New Member
Ok with this method the folder are hidden from browser. But

he link files from subfolder doesn't work. when the index page call the pages from subfolder it can't access.

Then How can i solve ?
Jul 31 '09 #5
Niheel
2,456 Recognized Expert Moderator Top Contributor
If you want to stop allowing your users to view the directory's files you can do one of two things:

1) create a blank index.html file and upload it to /front/

or

2) you might try create an .htaccess file with the following code and upload it to your /front folder

Expand|Select|Wrap|Line Numbers
  1. <Directory ~ "\.front"> 
  2. Options -Indexes 
  3. </Directory>
  4.  
Jul 31 '09 #6
Markus
6,050 Recognized Expert Expert
@luckysanj
You can program 'on PHP' using IIS, you know. :)

Going to move this over to Apache.
Jul 31 '09 #7
luckysanj
69 New Member
It doesn't work. It is like same problem. it display all the subfolder pages.
Jul 31 '09 #8
numberwhun
3,509 Recognized Expert Moderator Specialist
@luckysanj
First, which option did you try? Remember, if you add to your httpd.conf file, you have to restart your apache server for the changes to take effect.

Regards,

Jeff
Jul 31 '09 #9
rkrstar
3 New Member
You can keep an index file(index.html or which ever file you gave in DirectoryIndex) in your "front" directory or which ever directory you want to hide listing of files. It will prevent listing of files and directories.
Aug 1 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2361
by: Flier_75 | last post by:
Hi, I just password-protected an intranet site by including a password authentication script in each page of a private section. The script checks the login against the mySQL database. Appropriate file permissions have been set up on the private directory. My concern is now about protecting the Mysql password. Let's assume I use Apache to protect the access to this password (<files></files> or SetEnv in httpd.conf).
11
8911
by: LarryM | last post by:
Hi, NB, not to stop capturing the single displayed Image, but to stop downloading the entire image directory. (In my Website you will do a search, and get some thumbnails, and these can be enlarged one by one). This topic seems to be frequent. Some says that you under no circumstances can protect your images, others seem to have preventing solutions.
4
1372
by: LIN | last post by:
Can someone guide me with an article or advice me on how to UPLOAD ASPx files on the webserver. I am making the ASPx pages by creating a project in VS .NET. I have no clue how to deploy the solution on the webserver - what kind of build do i create to get ASPx pages - what happens to Global.asax etc Please advice. Thank You,
8
2202
by: George | last post by:
VS.NET 2002/VB My IIS permissions and folder settings show Read and Execute only. Why is it that I can use any browser and link directly to my DLL file in my BIN folder on my Web site and download it to my harddrive (as could anyone else who wanted to)? I don't see any other settings in my host's Control Center Panel that will let me set any other properties for those folders. How do I prevent this from happening? Thanks,
4
7576
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can subsequently be viewed on the site's pages. My hosting provider is requiring that any files my Web app writes get written to a folder that is above the app's root folder (for security purposes). When writing the files I understand how to use MapPath to...
4
4235
by: rn5a | last post by:
I have a ListBox which should list all the files & directories that exist in a particular directory. The problem is I can get the ListBox to list either all the files or all the directories but not the 2 of them together. This is what I tried: Sub Page_Load(.....) Dim dInfo As DirectoryInfo dInfo = New DirectoryInfo(Server.MapPath(MyDir))
8
8930
by: mdh2972 | last post by:
I would like to put all my .jpg images in a folder into an array to be viewed. can I use JS to do this automatically. Without having to type by hand?
2
1181
by: Eric Layman | last post by:
Hi, We have a remote webhost here that runs dotnet. Interestingly, it is not able to parse any aspx files It will show a run time error even if the aspx file is blank or doesnt even exist. I played around with web.config but nothing happens. RUNTIME ERROR
7
2347
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. I have an ASP.NET 2.0 web application which contains an Images directory with all website images. How can I prevent other websites from creating img tags with the source as my images? I want to prevent other websites from serving my image. For example - How can I prevent another website from doing this? <img src="http://mywebsitename/images/image1.jpg" Is this possible? Thanks
0
9656
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10527
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10573
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9358
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7773
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4001
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3102
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.