Archive

Archive for January, 2011

Zend framework – how do i put htpasswd ? mostly i forget it just writing it down now.

January 28, 2011 Leave a comment

How can i add htpasswd, while using Zend framework ? Forgot it, just writing it down.

1. put this

[xxx@www tmp]# htpasswd -c /etc/httpd/conf/users username
New password:
Re-type new password:
Adding password for user username

2.  Add those first four line

[root@www public]# cat .htaccess
AuthType Basic
AuthName “Restricted Files”
AuthUserFile /etc/httpd/conf/users
Require valid-user

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ – [NC,L]
RewriteRule ^.*$ index.php [NC,L]
[xxx@www public]#

 

3. Visit your http://www.website.com -> now it will ask username/password

 

Done.

 

Categories: centOS, PHP, Zend