Thread: Login Link
View Single Post
  #65  
Old 02-24-2009, 07:20 AM
 
ChristineP ChristineP is offline
 

eXpert
  
Join Date: Jul 2008
Posts: 310
 

Default Re: Login Link

Hi Robert,

I really want to try your suggestion! I've been back to my cpanel and I can get to the lowest-folder of /store/ and I add the name of the protected directory, though it protects the entire store instead of just the register.php. Do you know if I need to add/change something in the register.php to make this work?

Christine

Quote:
Originally Posted by robertswww
Hi Christine,

Try this... go back to your cPanel --> "Password Protect Directories".

1. Click on a Folder Icon (not folder name) to open it, such as: public_html
2. Keep doing this until you get to the lowest possible folder that contains the file you want to protect, such as: register.php

Add the folder protection to that lowest sub-folder. Go back to your web site via FTP and download the new .htaccess file that was added to that lowest sub-folder you just protected.

In the .htaccess file will be text such as:

AuthType Basic
AuthName "Restricted Access"
AuthUserFile "/home/[username]/.htpasswds/public_html/passwd"
require valid-user

Next, you will need to modify the .htaccess file so the protection applies to a single specific file using the <files> tags, as follows:

<Files [filename]></Files >

To protect the file "register.php", you would modify the .htaccess statement as follows:

<Files register.php>
AuthType Basic
AuthName "Restricted Access"
AuthUserFile "/home/[username]/.htpasswds/public_html/passwd"
require valid-user
</Files>

Preferably, test this on a test site, or a less important file, before taking it live.

Robert
__________________
______________
version 4.1.9 Gold
Reply With Quote