views:

35

answers:

2

Hello there I want to password protect one of my controllers in codeigniter. This is the code in .htaccess

# password-protect single file
<Files my_controller.php>
AuthName "my_controller.php"
AuthType Basic
AuthUserFile /home2/afolder/.htpasswds/.htpasswd
require valid-user
</Files>

the problem is that myController.php will show up in my url as /my_controller/ (no .php) so the protection has no effect...can I do something to overcome this problem? thanks in advance

A: 

Does this question answer yours? http://stackoverflow.com/questions/3366519/codeigniter-and-htaccess-protect-a-specific-controller-and-its-methods-via-auth

kevtrout
thanks, It is definitely close to what I'm looking for but I the answer wasn't so straight forward...can you please re-submit and explain?
rabidmachine9
A: 

Finally the solution was as simple as that...

# password-protect single file
<Files my_controller>
AuthName "my_controller"
AuthType Basic
AuthUserFile /home2/afolder/.htpasswds/.htpasswd
require valid-user
</Files>

just removed .php and everything is fine...

rabidmachine9