Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-05-2002, 07:04 PM   PM User | #1
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
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
Quote:
ErrorDocument 401 /ERROR_401.php
so I do this
Quote:
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?
lotrtrotk is offline   Reply With Quote
Old 07-05-2002, 07:18 PM   PM User | #2
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
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
Feyd is offline   Reply With Quote
Old 07-05-2002, 08:16 PM   PM User | #3
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
here's exactly what I have in my htaccess file
Quote:
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?
lotrtrotk is offline   Reply With Quote
Old 07-05-2002, 08:41 PM   PM User | #4
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
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
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 07-05-2002, 08:52 PM   PM User | #5
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
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
Feyd is offline   Reply With Quote
Old 07-05-2002, 10:43 PM   PM User | #6
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
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
lotrtrotk is offline   Reply With Quote
Old 07-06-2002, 03:22 PM   PM User | #7
Jeewhizz
Regular Coder


 
Join Date: May 2002
Location: London, England
Posts: 369
Thanks: 0
Thanked 0 Times in 0 Posts
Jeewhizz is an unknown quantity at this point
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
Jeewhizz is offline   Reply With Quote
Old 07-09-2002, 08:48 PM   PM User | #8
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
Quote:
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.
lotrtrotk is offline   Reply With Quote
Old 07-10-2002, 08:38 PM   PM User | #9
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
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:
Quote:
[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
Quote:
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
lotrtrotk is offline   Reply With Quote
Old 07-10-2002, 08:54 PM   PM User | #10
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
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
Feyd is offline   Reply With Quote
Old 07-11-2002, 03:35 PM   PM User | #11
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
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.
lotrtrotk is offline   Reply With Quote
Old 07-11-2002, 05:55 PM   PM User | #12
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
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
Feyd is offline   Reply With Quote
Old 07-15-2002, 05:00 PM   PM User | #13
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
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.

Quote:
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.
lotrtrotk is offline   Reply With Quote
Old 07-15-2002, 05:46 PM   PM User | #14
lotrtrotk
New to the CF scene

 
Join Date: Jul 2002
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
lotrtrotk is an unknown quantity at this point
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
lotrtrotk is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:31 PM.


Advertisement
Log in to turn off these ads.