Password Protecting CakePHP with htaccess and htpasswd - howto?

How can I password protect my site during development using htaccess in Cakephp?

  • Which htaccess file do I need to change?
  • what i need to write in htaccess
  • where do i put .htpasswd?

I searched on Google for this, but did not find anything useful, I hope you could help me!


Thanks until it helped me solve the problem!

For CakePHP users: - Change .htaccess to / app / webroot / - add something like this to the top of the .htaccess file:

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

Now create the .htpasswd-file file in / app / webroot / and put something like this in:

 admin:PASSWORD 

"PASSWORD" is a converted version of your real password, I created it using this tool: http://tools.dynamicdrive.com/password/

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

+7
passwords password-protection cakephp .htaccess .htpasswd
source share
2 answers

You probably have .htaccess at the root of your document, so you would add this file as it is the first, so to speak, if you want to protect the entire site. Otherwise, add the .htaccess file to the directory that you want to protect.

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

In short, this is what you add:

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

Add Users Command:

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

In any case, make sure you read everything!

+9
source share

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

The first link contains information about using .htaccess security in cake applications. Comments include:> hackish <workaround on how to do this for admin routes only.

0
source share

All Articles