Download & Extend

Clean URL's turn 404's into 500's - Reporting the Solution

Project:Drupal core
Version:5.3
Component:base system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

We have spent much time tracking this problem down, found a solution, and from what I see doing searches it affects many people with many hosting providers.

We had to initially comment out the .htaccess rules that make Clean URL's work. The solution to getting Clean URL's to work and not turning 404's into 500's is as follows:

Add the line:

  #Added to keep from getting 500 errors at 1&1 w/ Clean URLs enabled
  RewriteBase /

Just after:
  RewriteEngine on

to the .htaccess file in the web root. I will paste in more of the file so that you clearly see the proper context for this addition.

Maybe you would take a look at this and consider the change for the next update to Drupal.

Thanks!
Michael

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  #Added to keep from getting 500 errors at 1&1 w/ Clean URLs enabled
  RewriteBase /

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

Comments

#1

Priority:critical» normal

It would be helpful if you described what servers/configurations this solution is needed for.

#2

It is at least needed for 1&1 Linux servers which have the following specs per the status page:

Drupal 5.2
Configuration file Protected
Cron maintenance tasks Last run 20 min 43 sec ago
You can run cron manually.
Database schema Up to date
File system Writable (private download method)
GD library bundled (2.0.28 compatible)
MySQL database 5.0.45
PHP 5.2.1
Unicode library PHP Mbstring Extension
Web server Apache/1.3.33 (Unix)

It also affects their MySQL 4.0.x offering.

Let me know if further details would be helpful to look into this.

#3

Version:5.2» 5.3

I had the same problem on a dreamhost server. Suddenly some of my sites stopped working properly (got the 500 error when accessing any page other than the frontpage). It turned out, it only happened on the sites with clean urls on. The above solution finally solved my problem. Thanks!

#4

This solution worked for me on GoDaddy hosting.

Drupal 5.5 w/ clean URL's

Thanks again.

+N

#5

This works 100% for godaddy hosting, as seen in http://drupal.org/node/204419

#6

Backport

# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

these lines from D6 they are commented out anyways.

#7

Status:active» reviewed & tested by the community

Backported comments from D6.

AttachmentSizeStatusTest resultOperations
20080112.htaccess-virtualdocumentroot-comment.patch1.31 KBIgnored: Check issue status.NoneNone

#8

Status:reviewed & tested by the community» fixed

Committed to 5.x.

#9

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

#10

DreamHost users have to use following code in .htaccess for clean URL

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]