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
Require all granted
Require all denied
my .htaccess file
# deny everyone but myself
<Limit GET POST PUT>
Deny from all
K. Tsang wrote:Just how are you planning to distinguish yourself from everyone else?
Actually i could use ALLOW FROM xxx.xx.xx.x(my ip adress) but i don't have a static ip. So is there any way to use php,so that it can automatically get the current ip and set it in the .htaccess?
If you could get the IP it's most likely the internal router IP (192.168.x.x) rather than the public router IP. Once you have your IP, I don't think you can "dynamically" change the .htaccess file.
Actually what do you want to do exactly? Reading the content of the .htaccess file? Browsing the files in directory?
If it is the latter, then you can simply write a PHP script and the .htaccess file is not needed at all.
The whole directory listing is restricted if .htaccess is present in that directory. This is exactly what i want for every user who tries to access the directory,however i want myself to have access to that directory listing for me only being the owner of those files. Without having a static ip,how to achieve it,that's my concern.
Well I'm not security guy or Linux/Apache admin. But I can tell you this: from brief search, allowing IP to bypass .htaccess is unreliable. If the protected directory has an index.php page then you got a way in.