www redirection with htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Advertisements

htaccess login authentication

Add in .htaccess file:

AuthName “Restricted Area”
AuthType Basic
AuthUserFile I:/xampp/htdocs/my_proj/.htpasswd
AuthGroupFile /dev/null
require valid-user

Add in .htpasswd file:

admin:$apr1$gs0j3ctm$NICQOA7ANxOajPQcRVZA3.