Click here to Skip to main content
15,910,471 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
While i try to access the .htaccess file its saying access forbidden,which is obvious. But the listing of all other files also getting displayed,i.e no restrictions are imposed on those files which are under the same directory as the .htaccess. However i want to restrict everyone but myself from those files too. Here is my httpd.config

inside directory of httpd.config


Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride ALL

Require all granted

<pre lang="xml">
<Files ".ht*">
	Require all denied
</Files>


my .htaccess file

XML
# deny everyone but myself
<Limit GET POST PUT>
    Options -Indexes
    Order allow,deny
    Deny from all
</Limit>


[edit]Code block corrected[/edit]
Posted
Updated 24-Jun-13 11:30am
v3
Comments
Sergey Alexandrovich Kryukov 24-Jun-13 9:19am    
Access from where? Why would you ever need to access it?
—SA
sash_kp 24-Jun-13 9:31am    
Just for testing purpose whether .htaccess works or not with my xampp. When i enter the url of the directory in my browser,(directory in which .htaccess file is there),i don't want the listing of files to be shown.
Sergey Alexandrovich Kryukov 24-Jun-13 10:35am    
Of course you don't want it, but it does not mean you "access" this file directly. But you should better disallow index access in all the site.
—SA
sash_kp 24-Jun-13 16:15pm    
Yeah that's cool..So could you help in letting me know where to write "Options -Indexes" in my httpd.config?
sash_kp 24-Jun-13 16:16pm    
I mean in which specific part of the httpd.config?

1 solution

In httpd.config, it is done in a different way, unrelated to that of .htaccess, which provides setting local to the directory. Please see, for example: http://stackoverflow.com/questions/1988267/apache-options-indexes-configuration-not-working[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900