Home Codeigniter : Htaccess/Htpasswd in subfolder of controllers
Reply: 0

Codeigniter : Htaccess/Htpasswd in subfolder of controllers

user1156 Published in May 21, 2018, 4:57 pm

I try to protect a sub folder in a codeigniter's controllers folder with a simpler htaccess login prompt.

my app structure:

Ubuntu 16.04 LTS, php 7, Codeigniter 3.1.7

var/www/html/application var/www/html/assets var/www/html/system .htaccess index.php

the .htaccess in root folder is:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

In application/controllers, I've created an admin folder and added an admin controller in it: var/www/html/application/controllers/admin/Admin.php

the .htaccess in admin folder is:

AuthType Basic
AuthName "restricted area"
AuthUserFile /var/www/html/application/controllers/admin/.htpasswd
require valid-user

the .htpassword in admin folder looks like this:


when I navigate to the admin controller:


No login is asked and I get a blank page.

Do you have an idea?

Thank you for your help.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307914 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO