CakePHP的密码保护与htaccess以及htpasswd的 - HOWTO?密码保护、CakePHP、htaccess、HOWTO

2023-09-02 00:33:02 作者:毁你男神做你男人

我如何用密码保护我的网站开发与htaccess的过程中CakePHP的?

How can I password protect my website during development with htaccess in Cakephp?

在这htaccess文件做我必须要改变? 在做什么我都在htaccess的写 在哪里我把htpasswd的?

我搜索谷歌为,但找不到任何有用的,我希望你能帮助我!

I searched google for that but couldn't find anything useful, I hope you could help me!

由于直到帮我解决这个问题!

Thanks Till that helped me solve the problem!

有关CakePHP的-用户: - 修改的.htaccess于/ app / Webroot公司/ - 添加类似的东西在的.htaccess文件的开头:

For CakePHP-Users: - Modify the .htaccess in /app/webroot/ - add something like that at the beginning of the .htaccess-file:

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /complete/path/to/.htpasswd
AuthGroupFile /dev/null 
require valid-user

现在创建htpasswd的-文件/程序/ Web根目录/落像这样的:

Now create the .htpasswd-File in /app/webroot/ and drop something like this in:

admin:PASSWORD

密码是你真正的密码转换版本,我创建它使用此工具: HTTP:/ /tool​​s.dynamicdrive.com/password/

我觉得有更多的方法来创建此,但对我来说,它的工作,也许这可以帮助其他CakePHP的用户了。

I think there are much more ways to create this, but for me it worked and maybe this helps other cakephp users too.

推荐答案

您可能有一个的.htaccess 在你的文档根目录,所以你会添加到该文件,因为它是在第一的可以这么说 - 如果你想保护整个网站。否则,在你想保护的目录中添加的.htaccess 文件。

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.

然后,看看这个HOWTO: http://httpd.apache.org/docs/2.2/howto/auth.html

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

要添加用户的命令是:

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

请确保你看了上面的HOWTO呢!

Make sure you read the above howto anyway!