Protect a folder with .htaccess

La première étape est de créer sur votre disque dur un fichier appelé .htaccess :

AuthName "Page d'administration protégée"
AuthType Basic
AuthUserFile "/home/site/www/admin/.htpasswd"
Require valid-user

Créez maintenant un nouveau fichier avec votre éditeur de texte .htpasswd va contenir la liste des personnes autorisées à accéder aux pages du dossier. On y inscrit une personne par ligne, sous cette forme :

login:mot_de_passe_crypté

Comment peut-on crypter les mots de passe ?
Il y a une super fonction PHP qui va nous tirer d’affaire : crypt. Vous lui donnez un mot de passe et elle vous le crypte

<?php echo crypt('gourou'); ?>

extradrmtech

Since 30 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions and medias protecting solutions. I am experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. Besides my work, I like to work freelance only on some wordpress projects because it is relaxing and delightful CMS for me. When not working, I like to dance salsa and swing and to have fun with my little family.

You may also like...

Leave a Reply