Sunday, May 16, 2010

Internal Server Error when password protecting directory

Do you see something like that:???

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

Please contact the server administrator, webmaster@blahblah 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.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

There is a very simple explanation but it took me lots of time to discover the reason. Well, I'm not as good as I would like to be ;)

The reason -> FILE PERMISSION!!!

All directories have to have +xr access for the web server. You may have to make o+xr them.
Also the .htpasswd and .htaccess have to be accessible for the web browser.

Here is my .htaccess in the directory I want to have password protected:

AuthUserFile /home/myhome/.htpasswds/.htpasswd
AuthName "Login Area"
AuthType Basic
require valid-user

Since the web server is 'hosted', so the best thing to do is to run the phpinfo() on the web browser (create p.php file and put <?php phpinfo(); ?> in it) and look for DOCUMENT_ROOT to see where really are your web files located.
Make sure that all the directories leading to .htpasswd and .htaccess are having proper 'read/execute' attributes (644)

Tuesday, May 11, 2010

Google Calendar compatible Catholic Calendar in US