Question

How can I protect my webapp build with Codeigniter with a htpasswd during development? I tried this but I get 500 error.

AuthType Basic
AuthName "Authenticate please"
AuthUserFile /usr/html/.htpasswd
Require valid-user

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|files|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Was it helpful?

Solution

Your auth looks ok to me I have below that works fine. Are you sure you've created your .htpasswd file correctly and it lives at the location you specified?

<Files *>
AuthName "Please Login"
AuthType Basic
AuthUserFile /var/www/.htpasswd
require valid-user
</Files>

I would say something is wrong with your rewrite cond and rules. Any reason you are not using the one here -> http://codeigniter.com/wiki/mod_rewrite

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top