How to password protect resources on a ModX website using htaccess and htpasswd?

We are trying to protect several different resources in our ModX installation. The current .htaccess code is as follows (not including all ModX materials)

AuthName "Dialog prompt"
AuthType Basic
AuthUserFile /var/www/vhosts/mywebsite.co.uk/.htpasswd

<FilesMatch ^index.php\?q=71$>
    require valid-user
</FilesMatch>

The goal of the exercise is to protect the following resources:

I tried various combinations of LocationsMatch, Locations, Files and Filesmatch and cannot make it work.

Thank you in advance

+5
source share
3 answers

This is what was the complete solution:

- , , passwordprotect, : [[passwordprotect]]. ( ):

<?php

if(isset($_SERVER['PHP_AUTH_USER']) && ($_SERVER['PHP_AUTH_USER']=='user') &&     ($_SERVER['PHP_AUTH_PW']=='password'))
{
    echo 'You are successfully logged in.';
} else {
    header('WWW-Authenticate: Basic realm="Protected area"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Text to send if user hits Cancel button';
    exit;
}

EDIT: , , , , [[passwordprotect]], modx . : [[! Passwordprotect]] Revolution. , [! Passwordprotect!] Evolution. . , - !

0

ACL Revolution MODX. :

  • , .
  • .
  • .
  • .
  • .
  • , .
  • ACL - , .
  • .
  • , .
  • , .
  • .

, .

0

All Articles