2
votes

I hanv a htaccess file I block directories by

Options -Indexes

but I would like to allow admin directory. above code block admin directory too.

Second thing is some of hacker get all directory name of our site by search engine. if I disallow search engine for all secure directories in robots.txt file then hacker can read directories from robots.txt.

If I block .txt extention by

<FilesMatch "\.(htaccess|htpasswd|ini|txt|log|sh|inc|bak)$">

Order Allow,Deny Deny from all

this htaccess code can search engine read my robots.txt file for other directories?

conclusion: I would like to disallow all directories but allow admin directory. and also like to block secure directory from search engine.

I got answer for allow directory but second question not confirm that google can read or not.

1

1 Answers

0
votes

You will need to password protect your /admin folder and turn on indexes in that folder. Add your protected files inside that folder. Google nor anyone else will be able to read them without the password you made and stored in .htpass.

For example /admin/.htaccess

AuthUserFile /var/www/vhosts/example.com/httpdocs/.htpass
AuthType Basic
AuthName "Administration"
require valid-user

Options +Indexes

Read more about Apache Module mod_authn_file