deny direcotory listing, allow by ip

i want to deny directory listing via htaccess, but allot a certain ip (mine) to see it.
qwertqAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ahoffmannConnect With a Mentor Commented:
> this is not one location, and will not work. my source would reflect "dir-with-index-but-protected you/"
you're speaking in miracles, could you please explain this, probably with an eaxample of an URL and the error your and whatr you expect
0
 
ahoffmannCommented:
something like:

<Location /directory>
    Options       +Indexes
    <LIMITExcept HEAD GET>
        Order           deny,allow
        Deny from       all
        Allow from localhost
    </LIMIT>
</Location>
0
 
qwertqAuthor Commented:
hm, that seems to block access to the files inside.
i want the files contained in this directory to be visible, i only want to block dir listing
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
alimuCommented:
how about creating a second virtual directory that points to the same spot, allow your ip only and give it directory browse rights?
AJ.
0
 
qwertqAuthor Commented:
can this not be done simply with htaccess?
0
 
alimuCommented:
alternate solution if you can't get it going with htaccess (not really an answer to the question - sorry about that)
0
 
ahoffmannCommented:
you need a second <Location> one which has
  Option -Indexes
has no LIMITs, and one with
  Option +Indexes
has password protected LIMITs
0
 
qwertqAuthor Commented:
thank you a hoffman, but i have no idea what you are talking about
0
 
ahoffmannCommented:
<Location /dir-no-index>
    Options       -Indexes
</Location>
<Location /dir-with-index-but-protected>
    Options       +Indexes
    <LIMITExcept HEAD GET>
        Order           deny,allow
        Deny from       all
        Allow from localhost
    </LIMIT>
</Location>

if you call in your URL /dir-no-index you get a 404 not found ('cause index is off)
if you call in your URL /dir-with-index-but-protected you get a 401 not authorized except if caled from localhost
you may also add your public IP, or even network masks here

   Allow from localhost your.FQDN
0
 
qwertqAuthor Commented:
i was never able to get a working example of this problem.

i want ONE directory which will deny dir listing to it and all child directories to anyone except a certain ip. it needs to allow the website to use the contents of the dir as well.
0
 
ahoffmannCommented:
and what's wrong with my last suggestion?
"not working" is no valid answer
0
 
qwertqAuthor Commented:
"if you call in your URL /dir-no-index you get a 404 not found ('cause index is off)
if you call in your URL /dir-with-index-but-protected you"

this is not one location, and will not work. my source would reflect "dir-with-index-but-protected you/"
0
All Courses

From novice to tech pro — start learning today.