htpasswd的在codeigniterhtpasswd、codeigniter

2023-09-02 00:42:39 作者:好男人不止曾小贤〃

你好我想用密码保护我的codeigniter控制器之一。这是code在.htaccess

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>

问题是,myController.php会在我的网址显示为 / my_controller / (无.PHP),这样的保护没有任何影响......我可以做去克服这个问题? 在此先感谢

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

推荐答案

最后的解决办法是那样简单......

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>

只是删除​​.php然后一切都很好...

just removed .php and everything is fine...