I found the rewrite rules a bit buggy in Drupal 5.1. I discovered a suggestion that corrects the bad behavior. Simply add a $1 to the rewrite rule. Please update as follows:

  # If you want the site to be accessed WITH the www. only, adapt and
  # uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule .* http://www.example.com/$1 [L,R=301]
  #
  # If you want the site to be accessed only WITHOUT the www. prefix, adapt
  # and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule .* http://example.com/$1 [L,R=301]

The $1 simply tacks on the rest of the URL originally submitted to the server. This way the person browsing does not end up at the home page... www. is simply / silently added/removed from the URL. aaaahhhh....

Comments

mdlueck’s picture

Well, this solution seems to be buggy at one site. Best link you with the doc that put us onto a solution to this problem as the rewrite rules they suggest do work on this particular domain.

(shrug)

http://drupal.org/node/64645

So two suggested fixes. At least there is the possibility of fixing the annoying Drupal default behavior.

webernet’s picture

Status: Active » Closed (duplicate)
mdlueck’s picture

Thanks so much for pointing us to the solution ready for commit. Successfully implemented on our Drupal 5.1 servers.