Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    htaccess problem

    I need to be able to redirect my errors to another page.... I went to the following page, and did just what it said, but for some reason it doesnt work.

    http://www.javascriptkit.com/howto/htaccess2.shtml

    This is what I have. but I get a 500 error
    ErrorDocument 401 /ERROR_401.php
    so I do this
    ErrorDocument 401 /ERROR_401.php
    ErrorDocument 500 /ERROR_500.php
    (ERROR_401.php, and ERROR_500.php are actual pages by the way)

    but i STILL get the 500 error, what gives?

  • #2
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you put
    Options Indexes FollowSymLinks Includes at the top of your htaccess file?

    A 500 error after you've added/changed an htaccess file usually means the error is in the htaccess file, do you have access to error logs that could give you some more information on what is going wrong? Do you have anything else in your htaccess file?
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    here's exactly what I have in my htaccess file
    Options Indexes FollowSymLinks Includes

    AuthUserFile /var/www/regAccess/.htpasswd
    AuthGroupFile /dev/null
    AuthName "Kinsmen Children's Centre"
    AuthType Basic

    require valid-user

    ErrorDocument 500 /ERROR_500.php
    ErrorDocument 401 /ERROR_401.php
    as far as the error logs go... I assume I'd have access, I have root priveleges. Although, I dont know how to view them. I'm kind of a linux newbie. anyone know the commands to view the logs?

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    The logs are just text files located on your server. On another note I wouldn't put your htpassword file in a web accesible directory.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Definitely agreeing with Spook...your passwd file should be ABOVE your root directory (it looks like /var/www/ is your root, which is equivalent to yoursite.c.om).

    As far as logfiles, your host may have them setup in a certain way, or accessible from some type of control panel... Although it looks like your log files MAY be in /var/log/ or /var/logfiles. However, that isn't a guarantee...and if there are multiple sites on that one machine, more than likely the logfiles will always be located out of individual local virtual directories.

    As for your htaccess, nothing seems to be wrong with it. Provided that the path to your htpasswd is valid and does have read privileges, than both htaccess and htpasswd have been setup and uploaded as ASCII (no wierd LFs). And technically, your error document block should be just below the OPTIONS text, and before the authorization...Also, some hosts are odd, try removing the OPTIONS line completely and see what happens.
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #6
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the help Feyd... I'll try looking in /var/logs or something similar.

    just so you know... /var/www/ is not my root of my website.
    /var/www/html/ is the root. But I can see how someone could make that assumption

    peace

  • #7
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    assuming the host hasn't disabled htaccess I have that on one of my shared servers - a real pain! I can only do password protection...

    Which host are you with?

    Jee
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #8
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Which host are you with?
    my host is the company I work for. I don't imagine that htaccess is disabled. I mean, I set it up myself (that could very well be the problem right there), and it works fine withought those lines about the Error Documents.

    whatever... maybe I'll just mess around with some stuff, and hopefully get something right.

  • #9
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK, I've been busy with other things the past little while, so haven't had a chance to continue looking into this problem until now.

    I just took a look at my error logs, and this is what it says:
    [alert] [client 192.139.19.101] /var/www/html/temp/book/.htaccess: ErrorDocument not allowed here
    any ide what this means?

    In addition to that, I figured it might be useful if you all knew exactly what error message I get on the site
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.



    --------------------------------------------------------------------------------

    Apache/1.3.22 Server at saturn.sask.trlabs.ca Port 80
    I feel stupid still having to ask this but I am just at a loss for what to look for. If anybody knows anything about my problem... please give me a hand

  • #10
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, ErrorDocument not allowed here usually means an override problem...

    This means something in the server's configurations is overriding what you are trying to do...

    You can using this in your htaccess, instead:
    Code:
    <Directory "/var/www/html/temp/book/">
                    AllowOverride All
                    ErrorDocument 404   /error.php?code=404
    </Directory>
    This basically tells the server to take it's configurations and lose them, because you are in charge (insert evil laugh). (You can change the first Directory to just be <Directory /> to globally override the settings.)

    Or if you have access to access.conf on apache, you can search for AllowOverride None and change it to AllowOverride All (but note that you should only do this if NONE of your htaccess is working no matter what you do).

    Remember that you are messing with server settings, you could be compromising configurations on the box, so you might want to get permission before doing this, or just ask the admin to change the access.conf to override all.
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #11
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, well... when I saw that I was super excited, cause I was sure it was going to work. But alas, I still get the exact same thing.

    I was wondering... does AllowOverride have some different options? or is it just "All or None"? And where is the access.conf file located? I'd like to take a look at it, I assume I could just access it like a text file.

  • #12
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ehhh, ok...

    Let's cover the basics...

    Are you sure the file is named .htaccess and nothing else? That it doesn't have any weird LF or EL characters from Windows (remember, this is Apache and *nix). Was the file uploaded as ASCII, does it have atleast permissions of 644, and have you tried it with 755? Have you tried removing the Options Indexes FollowSymLinks Includes, considering that your box seems to be more tweaked than normal, you may not need that declaration. Are you sure you have the right path to your htpasswd file (and the same questions about naming, chmod, LF, ASCII, etc.)? Have you tried using your htaccess to JUST do error redirection without anything else (and vice versa with your password, since the box doesn't seem to be listening to your commands, it means certain directives could be disabled).

    Do you even know if your box supports htaccess at all? It is possible that htaccess files have been disabled in entirety, not just certain directives...
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #13
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, well first of all...

    I know that htaccess definately is enabled. It appears with a login box whenever you try to access anything inside /var/www/html/temp/book. This is pretty much all I want, it's just that if the user hits cancel, or gets three trys wrong, they get an ugly 401 error which I'd like to fix up.

    Are you sure the file is named .htaccess and nothing else? That it doesn't have any weird LF or EL characters from Windows (remember, this is Apache and *nix).
    Yes, the file is named .htaccess (when I go "ls -l" I see it there). As for the LF or EL characters, I dont know what those are... but I doubt that it has them. You see, I have access to the whole server, and have been connecting via SSH to make my changes. The .htaccess, and .htpasswd files were not uploaded at all. I created them right on the server in the directories I wanted them in. This doesn't involve windows at all. So I don't see how it could have those characters

    I'm not sure about the permissions you talk about. 644? 755? what do these numbers represent? (this may be where I'm having my problems)

    I've tried it both with and without Options Indexes FollowSymLinks Includes, but it doesn't seem to effect it either way.

    Hopefully you can see something now, that could be causeing the problems.

  • #14
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    tried the chmod thing...

    I saw the other post asking about CHMOD'ing. I at least have an idea now what it is and how to use it. I typed chmod a=rx .htaccess in my temp/book directory (where I have my htaccess file). I assume you would only need read, and execute for this situation (if you even need both of them. Maybe I just need read or something).

    I got no indication that the command worked, but there was also no error saying that it DIDN'T work.
    I still get the same problem 500 error though. So I doubt if this is what caused the problem anyway


  •  

    Posting Permissions

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