How to protect a single php page with htaccess?

I want to restrict a PHP page in a website. This page is in a CMS.

The page is like this.

http://bioenergysciences.com/innerpage.php?id=1

For this I have updated my .htaccess file like this.

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /home/bioenerg/password/.htpasswd 
AuthGroupFile /dev/null 
<Files http://bioenergysciences.com/innerpage.php?id=1>
   require valid-user
</Files> 

Then I created .htpasswd file in a folder called “password”. Because this is not secure if we created this in the root folder.

Then I added the generated password to this file.
My .htpasswd file is like this.

bioenergysciences:NnrhAhZ/Nc912


Source: .htaccess

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.