Question

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!

Était-ce utile?

La solution

Try using LocationMatch:

<LocationMatch "(.*/|index.php)$">
    Require valid-user
</LocationMatch>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top