1

I've got a simple htaccess set up with which I only want to protect my index.php file. I wrote down the following which seems the most logic, but it just tells me 401 Authorization Required. If I open up the link WITH index.php, it does prompt me for a login, otherwise not.

Is there any way I can trigger that login without adding index.php to the link? I really only want the index.php protected.

<Files index.php>
  require valid-user
</Files>

Thanks!

Manuel
  • 130
  • 2
  • 8

1 Answers1

2

Try using LocationMatch:

<LocationMatch "(.*/|index.php)$">
    Require valid-user
</LocationMatch>
David Wolever
  • 148,955
  • 89
  • 346
  • 502