www.webdeveloper.com
Results 1 to 3 of 3

Thread: members area using .htaccess

  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Question members area using .htaccess

    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

  2. #2
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    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

    HTML Code:
    <!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:
    Code:
    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=
    54 68 65 42 65 61 72 4D 61 79

  3. #3
    Join Date
    Mar 2009
    Posts
    2
    Many thanks! I used the above and got the path name Put that in the fle and it worked

    Many thanks!!!

    Martine

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles