I have a secret folder on my hosting, which may not be seen by visitors. I've added a robots.txt
to htdocs
:
User-agent: *
Disallow: /super-private/
However, if a visitor goes to http://example.com/robots.txt, he can see the name of the private folder. Is there anything to be done? Htaccess maybe?
robots.txt
is not the solution here. All it does is tell things like search engine spiders that a particular URL should not be indexed; it doesn't prevent access.
Put a .htaccess
file in super-private
containing the following:
Deny From All
Once you've done this, there's no need for robots.txt
, as it'll be inaccessible anyway. If you want to allow access to certain people, then look into authentication with .htaccess
.