Thread: Login Link
View Single Post
  #63  
Old 02-16-2009, 06:22 AM
 
robertswww robertswww is offline
 

X-Adept
  
Join Date: Jul 2003
Posts: 586
 

Default Re: Login Link

Quote:
Originally Posted by ChristineP
Yes, I want to do the later part of your suggestion, to password protect register.php file. Per your suggestion, I checked our cpanel Password Protect Directories, though this only allows to protect an entire folder. Do I need to move my register.php to it's own folder to acheive this?
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
__________________
X-cart 4.1.10
Reply With Quote