htpasswd的在codeigniter [英] .htpasswd in codeigniter

查看:131
本文介绍了htpasswd的在codeigniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我想用密码保护我的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...

这篇关于htpasswd的在codeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆