Home > centOS, PHP, Zend > Zend framework – how do i put htpasswd ? mostly i forget it just writing it down now.

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

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.

 

Advertisements
Categories: centOS, PHP, Zend
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: