Forum Moderators: phranque

Message Too Old, No Replies

htaccess problem on my site

         

charlieandlaura2002

2:09 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



hi,

I'm trying to build my own little site. It's been going pretty well so far. I've built the site, did all the graphics, links all working etc..... .. . .. however... .. .......... onto the tricky bit!

How on earth do I make the .htaccess file call up the pop up window?

The username and password pop-up appears with "AuthUserFile /dev/null" (no inverted commas) so my server does support .htaccess. I am using blueyonder by the way. Problem is that when I change /dev/null to the actual unix path of the .htpasswd file all I get is redirected to a 403 forbidden standard page without any pop ups. Can't understand it! I've been pulling my hair out trying to get it to work!

PLEASE HELP!

Laura x

[edited by: jatar_k at 4:25 pm (utc) on Jan. 21, 2004]
[edit reason] see TOS [webmasterworld.com] [/edit]

RussellC

2:22 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



make sure to chmod the .htaccess file to 644.

charlieandlaura2002

2:24 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



errrrrmmm chmod? can you explain this please? How do I do that at all?

Laura x

[edited by: jatar_k at 4:26 pm (utc) on Jan. 21, 2004]
[edit reason] see msg1 [/edit]

charlieandlaura2002

2:32 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



ok, just read all about chmod (change mode) and I would like to ask how to chmod a file if I am not running Unix. I am uploading the file to my server (who are running Unix)

RussellC

2:33 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



chmod changes the access permissions on a file. You can also change access permissions using an FTP client to make it readable.

Try this:

[javascriptkit.com...]

charlieandlaura2002

3:34 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



I have read that and loads of other posts like it but all you get is 403 forbidden and still no pop up. Please help!

RussellC

3:45 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Were you able to set the permissions on the .htaccess and .htpsswd files?

charlieandlaura2002

4:04 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



I set the permissions by using chmod in a dreamweaver FTP log window. I changes them to 644.

Still the same thing though, automatically directed to a 403 forbidden page with NO pop up!?!

Any ideas please?

RussellC

4:24 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



I am not sure what is going on. Maybe someone else has a better idea. Post what is in your .htaccess file.

charlieandlaura2002

4:27 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



My .htaccess file is as so:

AuthName Protected-Directory
AuthType Basic
AuthUserFile /htdocs/MEMBERS/.htpasswd
<limit GET POST>
require valid-user
</limit>

bcolflesh

4:31 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AuthUserFile /htdocs/MEMBERS/.htpasswd

Possibly not the correct path - usually it would be the complete virtual host path, ie:

/export/yourdomain/htdocs/MEMBERS/.htpasswd

Check with your server admin.

charlieandlaura2002

4:46 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



is there another way to find out the complete virtual host path? Every time i call them with any queeries more complex than resetting the modem they get very confused!

Just called them there and asked them if they can tell me my complete virtual host path and they told me that they 'dont store that information' and that that information is only available to me through my 'FTP client'.

If he means through Dreamweaver then dreamweavers site manager window shows the root directory as /htdocs. There is nothing showing above that?

Any ideas?

bcolflesh

4:49 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Upload a page named phpinfo.php containing:

<?php phpinfo()?>

This will have the info you need.

Birdman

4:50 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When you get the Forbidded error, it should give the complete path. I think.

charlieandlaura2002

5:01 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



bcolflesh, I have uploaded a page named phpinfo.php containing:
<?php phpinfo()?>

when I open the page I get a little table containing:

Configuration File(php.ini)Path: /usr/local/lib/php.ini

Does that mean that I should change to AuthUserFile /usr/local/lib/htdocs/MEMBERS/.htpasswd

?

THANKS guys, you've been a brilliant help so far! I have a feeling you're gonna crack this problem for me!

charlieandlaura2002

5:03 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Birdman, it doesn't give me a path at all. IT just gives the http address in the address bar and an error saying:

403 Forbidden
You don't have permission to access those file(s).

bcolflesh

5:03 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Does that mean that I should change to AuthUserFile /usr/local/lib/htdocs/MEMBERS/.htpasswd

No - that's not the one you want - somewhere near the bottom of that page, you'll see the path to the actual script:

/something/x/x/phpinfo.php

That's the one you want.

<edit> look for SCRIPT_FILENAME </edit>

RussellC

5:05 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



It should say _SERVER["SCRIPT_FILENAME"] /var/www/html/phpinfo.php or whatever your path is.

<edit> Oops bcolflesh beat me to it with his edit </edit>

charlieandlaura2002

5:08 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



I've found the table entry:

_SERVER["SCRIPT_FILENAME"] /usr/local/bin/php

Does that mean I change it to

AuthUserFile //usr/local/bin/php/htdocs/MEMBERS/.htpasswd

?

hakre

5:09 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi charlieandlaura2002,

in the output of your phpinfo.php script, take a look for the following environment or php variables:

- PATH_TRANSLATED
- SCRIPT_NAME
- SCRIPT_FILENAME

one of these should exist at least if php is running as cgi. they will contain the complete path, so you can get what you're looking for.

hope this helps,
-hakre

bcolflesh

5:11 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Like hakre said - check one of those - the correct one will end with the phpinfo.php page, ex:

SCRIPT_FILENAME /export/apache/info/htdocs/phpinfo.php

so you file would say:

AuthUserFile /export/apache/info/htdocs/MEMBERS/.htpasswd

charlieandlaura2002

5:21 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Eureeka......... . except, well, firstly thanks guys for your help, you have no idea how much I appreciate this!

You've helped me establish the complete virtual host path and now I am getting somewhere! The popup is appearring now!

HOWEVER! When I type in the password it's not having it! It's just letting me enter it 3 times and then giving me a forbidden error now

:-(

You'd think they could make this sort of thing easier eh? Especially consodering the amount of amateur sites out there?!

Anyway, any ideas? I've followed a lot of sites word for word in creating the .passwd file and it looks something like this:

laura:LefWrvTBNTQg2

What have I done wrong now please guys?

Birdman

5:22 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On my server, it's more like this:

AuthUserFile /path/to-root/.htpasswds/folder/passwd

Where "folder" is the protected folder.

RussellC

5:23 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



How about _SERVER["DOCUMENT_ROOT"] /var/www/html

<edit> Nevermind looks like you got it finally. Your htpasswd file looks normal, you just need to make sure the permissions are 644 and you are pointing to the correct dir that the .htpasswd file is in. </edit>

[edited by: RussellC at 5:27 pm (utc) on Jan. 21, 2004]

Birdman

5:25 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't believe you want the (.) before the passwd.

The file should be named "passwd" only. No dot, no extension

bcolflesh

5:26 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to telnet or ssh to that directory on the server and do the following from a command line:

htpasswd -c .htpasswd theusernameyouwant

You'll be prompted to provide the password after you press enter.

charlieandlaura2002

5:26 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Do you still think its the path? I'm getting the pop up now with :

AuthUserFile /abc/def-g/hijkl6/m/nopqrst/htdocs/phpinfo.php/MEMBERS/.htpasswd

can it still be the path thats the problem if I am getting the popup?

RussellC

5:27 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



Take the phpinfo.php out of there

should be:

AuthUserFile /abc/def-g/hijkl6/m/nopqrst/htdocs/MEMBERS/.htpasswd

charlieandlaura2002

5:36 pm on Jan 21, 2004 (gmt 0)

10+ Year Member



EUREKA!

When I read back on this thread there's no way I'd have been able to get my members area working without you guys! THANK YOU SO VERY MUCH!

Do you want the address of the site so you can check me out? It's far from finished but at least thanks to you all I have a good framework and can get started on the members area now!

THANK YOU THANK YOU THANK YOU

LAURA ****xxx

hakre

5:38 pm on Jan 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



and another thing:

Anyway, any ideas? I've followed a lot of sites word for word in creating the .passwd file and it looks something like this:

laura:LefWrvTBNTQg2

What have I done wrong now please guys?

if it's a *nix system, this should be right. if it's a win32 system, you need to create the 'passwordcrypt' with an algorythm called md5. the tool which was promoted on top of this page can handle both. it will take the default for the system it's running on. so if you execute it on the server (if you can), then it should create the right hash for your password. a hash is the value after laura: called: LefWrvTBNTQg2

-hakre

This 31 message thread spans 2 pages: 31