Cakephp Password Protection with htaccess and htpasswd - howto?

落爺英雄遲暮 提交于 2019-11-30 20:19:20

You probably have a .htaccess in your document root, so you would add to this file since it's the first so to speak -- if you want to protect the entire website. Otherwise add a .htaccess file in the directory you wish to protect.

Then, check out this howto: http://httpd.apache.org/docs/2.2/howto/auth.html

In a nutshell, this is what you add:

AuthType Basic
AuthName "dev"
AuthUserFile /complete/path/to/.htpasswd
Require valid-user

The command to add users is:

htpasswd -c /complete/path/to/.htpasswd yourusername

Make sure you read the above howto anyway!

http://snook.ca/archives/servers/password_protect_admin/

The first link has information on using .htaccess security from within cake apps. The comments include a >hackish< workaround on how to do this for only the admin routes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!