473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do I use .htaccess to stop webserver listing all files in directory?

61
Hi guys,

Currently in my webserver I got a directory call: ..../htdocs/upload/

Currently, all files are listed when users go to www.mysite.com/upload/

The way it works, when user click on a file link in my system, they redirected to this directory like this:

www.mysites.com/upload/invoice.txt

So If I have

Expand|Select|Wrap|Line Numbers
  1. deny from all
It stops listing all files but in the process doesn't allow me to view files when I click on the link.

Is there a way I can tweak it so when users directly go to

www.mysite.com/upload/
they get 403 error BUT if they go they go to:
http://mysite.com/upload/invoice.txt
they don't get 403 error?

Thanks.
Mar 4 '12 #1

✓ answered by Alien

Using
Expand|Select|Wrap|Line Numbers
  1. IndexIgnore *
worked for me.

I can still open files directly without seeing the index listing when I just do upto /upload

2 2033
Alien
61
Using
Expand|Select|Wrap|Line Numbers
  1. IndexIgnore *
worked for me.

I can still open files directly without seeing the index listing when I just do upto /upload
Mar 4 '12 #2
Luuk
1,047 Expert 1GB
You could also put an empty index.html file in that directory.
(or one with some text, explaining why there's noting to see there...)

Or the following index.php:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.         header('Location: ..');
  3. ?>
  4.  
Mar 31 '12 #3

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

Similar topics

3
by: xEM | last post by:
I have in Apache2 (win32) aliased directory, for example: Alias /ftp/mp3/ "D:/mp3/" <Directory "D:/mp3"> .... </Directory> Address to this directory will be: http://localhost/ftp/mp3/ How...
1
by: Sims | last post by:
Hi, I have a few different templates that I want to list so my clients can see different styles that are available. So I want to offer them a drop down menu listing all the styles. But to...
7
by: Jennica Humphrey | last post by:
Hi, just as the topic says, how do I get the names of files within a directory? The examples I've seen appear to be *nix-specific. I'm using .NET but would like to avoid MFC if at all possible.
0
by: Don | last post by:
I intermittently get a runtime Compilation Error that says 'The compiler failed with error code 2000'. It appears that a DLL cannot be found in the 'temporary asp.net files' directory. The...
1
by: Shawn Mehaffie | last post by:
I have an application I want to be able to: 1) Store user specifc settings in ther "My Documents". 2) Store some information in "All Users" document directory. 3) I also want to be able to...
3
by: dougawells | last post by:
Hi - I'm hoping for help with the auto-generation of a hyperlinked listing of all files in a directory. The server I use does not auto-generate this. So, when someone comes to this directory and...
1
by: TahoeKid | last post by:
I need to modify and assemble the assembler listing files generated from the VS 2005 IDE. A test generated listing file did not assmeble 'as is'. Has anyone tried this? It seems to me the...
2
by: Mike P | last post by:
Is it possible to write some code to print to the screen a listing of all files within a directory? I want to show the path of each file on screen and enable the user to download any of the files....
2
by: Jay Garland | last post by:
How can I list 20 files in a directory and have multiple pages of 20 files? Like you see on memberlists, there's 10 pages but 20 members per page.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.