Click to See Complete Forum and Search --> : members area using .htaccess


caleywytch
03-10-2009, 07:29 PM
Hi all,

Apologies to begin with... I'm a bit of a newbie and have what will probably be a really silly question for you all.

I have bought hosting with 123-reg (yes I know probably a big mistake)... I am trying to create a member area on my site.

Now 123-reg doesn't use anything sensible like PHP, Javascript etc and according to their support the only way I can do it is to us .htaccess and .htpasswd.

Fair enough. I have the two files (password one has been encrypted). The .htaccess file contains the following:

AuthType Basic
AuthName "Members"
AuthUserFile /home/vhosts/ftp@mywebsite/.htpasswd
Require valid-user
require user USERNAME
order allow,deny
allow from all

It has been stored in the dirctory that I want to protect.

Now my problem is that 123-reg support claim I needed to put .htpasswd file at the root... fair enough... but I cannot write any files to the root.

I have tried moving the file down a level to public_html and changing the path in .htaccess

Have I missed something obvious? Is the answer so simple that I just am not seeing it?

Any help would be very much appreciated.

Many thanks,



Martine

TheBearMay
03-11-2009, 08:08 AM
They mean the root of your website, but that's not technically required either. Just looking at the above, my guess is that your path may be incorrect.

Save the following as PrintEnv.shtml


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Apache Environment</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<pre>
<!--#printenv -->
</pre>
</body>
</html>

Add the following lines to your .htaccess file:

AddType text/html .shtml
AddHandler server-parsed .shtml

Navigate your browser to display the PrintEnv.shtml file from above and then take the path displayed from the line that starts:
SCRIPT_FILENAME=

caleywytch
03-11-2009, 03:39 PM
Many thanks! I used the above and got the path name :) Put that in the fle and it worked :)

Many thanks!!!

Martine