So I was trying to install the Drupal 6.20 Content Management System (CMS) in a shared hosting environment. My hosting provider uses a LAMP technology stack to provide hosting. As I was using the CMS for development purposes, I decided to put the CMS files in a sub-folder as opposed the extracting it to the root of my domain. On visiting the URL to begin the Drupal installation procedure I received the following error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@******** 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.
After much digging around it turns out there were two problems with my installation and both related to the .htaccess file that resides in the root of the Druapl directory structure. If you quickly want to check if the .htaccess file is causing your problems try renaming it to something innocuous (e.g. .htaccessOLD) and trying your Drupal installation again. The two things giving me problems were:
1. The fact I had put all my Drupal files in a sub-folder on my domain.
2. My hosting provider settings for Apache web server, of which I have no control over.
To address the first problem was simple. If you edit the .htaccess file in a text editor you should see the following near the bottom of the file:
# Modify the RewriteBase if you are using Drupal in a sub-directory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /
The part that is important has been bolded. You simply need to remove the comment from this line and modify the path so that it points to the sub-folder containing your Drupal files.
The second problem was a bit trickier to resolve and will be dependant on what your hosting provider supports in terms of Apache or VirtualHost configuration. I emailed my provider telling them what I was trying to do and they told me the only thing they support in .htaccess files was “mod_rewrite” and I would need to remove unsupported commands. To this end, I commented out everything in the .htaccess file and tried my Drupal installation procedure again (it worked). I then went through the .htaccess file again uncommenting one command block at a time. If my installation still worked I left it and if it brought up the 500 error again, I re-commented it out.
It is not recommended to remove the .htaccess file entirely as your Drupal installation will be less secure (for example people will be able to view your .module files using PHP).