PDA

View Full Version : .htaccess and 500 Internal Server Error



dpfaigin
04-14-2004, 12:42 PM
I'm attempting to move over my site from its previous host, and I'm running into a problem with .htaccess files.

On my previous site, I had a family tree, but some family members asked that I keep some details private, so I put on a .htaccess file that required a password for access to the more detailed portions.

I copied this over to westhost, and made sure the files, directories, and paths were correct. However, when I try to access that part of the page, I get:


The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, Postmaster@cahighways.org 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.

Does anyone know how to resolve this? Do I have to switch to using the password protection ability though site manager?

Daniel

wildjokerdesign
04-14-2004, 02:31 PM
This is a busy day for you! :D

An .htaccess in a directory from your other site should work fine if it is pointed to the correct password file. Is there any more info you can give us on this without revealing to much. Is the .htaccess file simply protecting the directory? Are the password files perhaps placed someplace that needs the permissions changed?

I can't think of any reason why you would need to use the Site Manager password protect program. I know I have uploaded stuff from other sites before and it has worked. I think I have always kept all my files in the www directory when doing this. It could be if you are placeing your password file outside the www directory that the directory or file permission might need to be looked at. Check the existing .htaccess files that WH programs are using. Most of them point to the main password file that is not in the www directory. That may give you a hint on where you could place your password files if you want them outside the www directory.

dpfaigin
04-14-2004, 02:36 PM
The .htpasswd file is in a different directory (but I give it a different name), and I've checked that it has world read access. The .htaccess file similarly has world read access.

Daniel

FZ
04-14-2004, 02:38 PM
Daniel, I think you'll need to paste the contents of your .htaccess file for us to be able to help you further...

wildjokerdesign
04-14-2004, 02:51 PM
AuthName "Name of Restricted Area"
AuthType Basic
AuthUserFile /full/path/to/.htpasswd
require valid-user


If it looks like the above then you should be ok. Also take a look in your httpd.conf file located in /ect/httpd/conf

Not to far down from the top there is mention of .htaccess files and the password files for them. You shouldn't have to change anything here but if your the method you are using is not straight forward that may be a file you need to work with.

dpfaigin
04-14-2004, 03:09 PM
THis is the file:



AuthName Faigin/Davis Family Tree
AuthType Basic
AuthUserFile /home/cahighways/filename

require valid-user



The mode is:

-rw-r--r--

Emacs shows it as (DOS) mode, meaning it uses (CR)(LF) instead of the Unix (LF) at ends of lines.

Daniel

wildjokerdesign
04-14-2004, 04:12 PM
May be you need to convert the file to Unix. I know this was an issue elsewhere. Torrin came up with a way to do it via SSH the part of the thread on that starts here http://forums.westhost.com/phpBB2/viewtopic.php?p=9704&highlight=dos2unix+inputfile+ outputfile#9704

In the end I think this was the solution:


In that case, you can open the file in vi and type . . .


:set fileformat=unix

and then save it and quit with . . .


:wq

dpfaigin
04-14-2004, 04:31 PM
I tried that. It didn't solve the problem.

torrin
04-15-2004, 07:43 AM
Mine looks like this.



AuthUserFile /www/torrin/filename
AuthGroupFile /dev/null
AuthName webalizer
AuthType Basic
<Limit GET>
require valid-user
</Limit>


I don't think the AuthGroupFile will do anything, but does it help if you put in the 'Limit' lines?

FZ
04-15-2004, 11:37 AM
Are spaces allowed in the AuthName?


AuthName Faigin/Davis Family Tree

vs


AuthName "Faigin/Davis Family Tree"

Also, I'd remove the excess whitespace between lines too, just in case that might be causing a problem.

maida
05-16-2004, 05:48 AM
Well, I've been working on the same problem with one of my client sites and finally got it working. Not sure which fixed it for sure, but here is what I did

As Fayez suggested, I removed whitespace between lines and removed spaces from the AuthName (Thanks Fayez!)
I didn't try the quotes, and now that I have it working, I've decided that a one word AuthName is fine with me. ;)

Also, in the .htpasswd file, I deleted an empty blank line at the end of the file.

Hope this helps someone...

Maida

FZ
05-16-2004, 12:49 PM
No problem, Maida. I'm pretty sure that the extra whitespace and/or "not-quoting" of the AuthName is what messes it up.

maida
05-16-2004, 01:34 PM
One more thing...Daniel, if you are still reading this thread and trying to find a solution...did you check the error log? I had trouble finding my error log...the manual says its in /www/logs/ but I found mine in /var/log/httpd

And it actually told me the problem:


[Sun May 16 05:40:05 2004] [alert] [client 66.1.107.31] /var/www/html/retailer/.htaccess: AuthName takes one argument, The authentication realm (e.g. "Members Only")

Maida

FZ
05-16-2004, 03:12 PM
There you go - that [error message] confirms that you need to quote an AuthName if it has spaces.

bdh
06-20-2004, 10:48 PM
Hi Everyone...

I have an .htaccess problem that I can't seem to figure out.

Since this post was already established I thought this is where I should post..

I've just set up awstats and everything seems to work great..
I'm now to the point to where I need to secure the awstats.pl file

At this point, I'm dead.. I've tried setting up an htaccess in the cgi-bin
to protect the awstats.pl file only...
but
I seems to be protecting the whole directory...
Can anyone tell me how to be able to protect just the file awstats.pl
instead of the whole directory..

Best Regards,

Bruce

jalal
06-21-2004, 12:56 AM
I have this in my /var/www/cgi-bin/.htaccess file:

AuthName "Webmaster login"
AuthType basic

<FilesMatch "^awstats\.pl$">
AuthUserFile /var/www/cgi-bin/.htpasswd
require valid-user
</FilesMatch>

Seems to work fine.

HTH

bdh
06-21-2004, 06:37 AM
Thanks HTH,

excellent, worked first run.. Thank you VERY much...

BDH