keys with htaccess on a server with cakephp

0

I have a page in

midominio.com.co/descargas/mibd.html

this page is hosted in webroot/descargas/mibd.html

I'm creating an htaccess there, this is your location

webroot/descargas/.htaccess 

and I think I have some error calling it or creating it because it does not work, then I show you what I get:

.htpasswd

Andres:$apr1$jX8xN1hg$VJJSDz6GR5qtQVkV40EQA0

.htaccess

AuthName "Restricted Area"

AuthType Basic

AuthUserFile /var/www/midominio.com.co/descargas/.htpasswd

AuthGroupFile /dev/null

require valid-user

The idea is that when I go to the page midominio.com.co/descargas/mibd.html I ask for a password to see the content

For security reasons I can not give the true url of "mydomain" and "mibd.html" you see your real name in the error image.

    
asked by Andrés Vélez 06.04.2018 в 21:17
source

1 answer

1

see if in the .conf of the virtualhost (to find out what is $ sudo apache2ctl -t -D DUMP_VHOSTS ) it is usually /etc/apache2/sites-enabled/000-default.conf

There is a section for that folder and if that section is enabled the .htaccess

<Directory /var/www/midominio.com.co/descargas/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

AllowOverride All < -

Optionally you can define the auth directly in the same section of the .conf

Edit 2: I just saw that it is a shared hosting, according to the hosting page you have cPanel, you should look for the option to protect folders. It is usually under the Security category If you do not have it enabled you should contact the hosting support

Edit 3: In some cases you should edit the generated .htaccess to include the line:

ErrorDocument 401 default
    
answered by 06.04.2018 в 21:32