-2

I have lot's of PHP pages in public_html folder. But I want nobody to open them except me. I don't have any registration or anything else. I just don't want anybody access them. Is this possible? Those pages are for getting reports form database.

I've tried .htaccess but not a useful try.

Messi Meysam
  • 201
  • 1
  • 9

2 Answers2

1

Just include

Option -Indexes

in .htaccess file and save it. Then nobody will get access to that. Thanks.

Gaurav Kumar
  • 334
  • 1
  • 7
  • Can you please and please explain more, because I think I'm doing the whole thing wrong. I have two pages named *stats.php* and *check.php* in the root directory. and I want to block other people's access to these two pages except myself – Messi Meysam Dec 16 '17 at 19:04
  • Sure. I think you should just visit the link: http://www.htaccess-guide.com/ and do whatever you wants to do with .htaccess file. It simple and easy to apply. You just have to copy and paste the content to .htaccess file for each condition. Thanks. – Gaurav Kumar Dec 16 '17 at 19:07
  • @GauravKumar your answer only hides the directory indexes by presenting a 403 HTTP error, not preventing access to the resources themselves. Although it makes it considerably more difficult for someone to find those files, they are still accessible to people who guess them, stumble upon them, or have knowledge of what PHP files OP wants to hide. – andrewgu Dec 16 '17 at 19:34
0

The Apache .htaccess file is meant to rewrite responses by either granting or denying access to users based off the request made.

You can use an .htpasswd file in conjunction with you .htaccess file to selectively grant or deny users access to your resources by requiring authentication via a password.

andrewgu
  • 1,562
  • 14
  • 23