?
Solved

deny direcotory listing, allow by ip

Posted on 2005-03-11
13
Medium Priority
?
191 Views
Last Modified: 2010-04-20
i want to deny directory listing via htaccess, but allot a certain ip (mine) to see it.
0
Comment
Question by:qwertq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
13 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13528370
something like:

<Location /directory>
    Options       +Indexes
    <LIMITExcept HEAD GET>
        Order           deny,allow
        Deny from       all
        Allow from localhost
    </LIMIT>
</Location>
0
 

Author Comment

by:qwertq
ID: 13529487
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
 
LVL 14

Expert Comment

by:alimu
ID: 13531335
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

Author Comment

by:qwertq
ID: 13531417
can this not be done simply with htaccess?
0
 
LVL 14

Expert Comment

by:alimu
ID: 13532455
alternate solution if you can't get it going with htaccess (not really an answer to the question - sorry about that)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13533465
you need a second <Location> one which has
  Option -Indexes
has no LIMITs, and one with
  Option +Indexes
has password protected LIMITs
0
 

Author Comment

by:qwertq
ID: 13534766
thank you a hoffman, but i have no idea what you are talking about
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13538918
<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
 

Author Comment

by:qwertq
ID: 14327910
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 14329227
and what's wrong with my last suggestion?
"not working" is no valid answer
0
 

Author Comment

by:qwertq
ID: 14329565
"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
 
LVL 51

Accepted Solution

by:
ahoffmann earned 375 total points
ID: 14331440
> 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

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question