We are having some issues with our website which has a mix of Drupal site (primary) and subdomains on the server which are not Drupal sites. I suspect it all has to do with .htaccess but I'm not sure. Hoping someone with more experience can help.
Basic set up: Our primary website (www.xyz.com) runs on Drupal. We also have several subdomains (e.g. sub.xyz.com) set up on that same server which are not Drupal sites
Errors we are seeing:
1. mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary., referer: http://sub.xyz.com/
(I'm unable to reproduce this issue, we just see it in the error log now and then)
2. pages which are non-existent in the subdomain should be returning 404 errors, but instead they return 500 errors
The .htaccess (below) is set up for the primary domain, but there is no .htaccess file for the subdomains (does there need to be?). Can someone with more familiarity with .htaccess look at this and tell me if something is outright messed up here? Thanks in advance.
AddType audio/x-ms-wma wma
AddType video/x-ms-wmv wmv
AddType video/x-ms-asf asf
AddType video/x-ms-asf asx
AddType video/x-ms-asf asx
AddType video/x-flv flv
RewriteEngine on
#09.27.2010 Redir for wii
RewriteCond %{HTTP_HOST} ^xyz\.com$ [NC]
RewriteCond %{HTTP_USER_AGENT} Nintendo\ Wii
RewriteRule ^(.*)$ http://wiisite.xyz.com/$1 [L,R=301]
# Forces xyz.com to use "www"
# All other browsers
RewriteCond %{HTTP_HOST} ^xyz\.com$ [NC]
RewriteRule ^(.*)$ http://www.xyz.com/$1 [L,R=301]
## REDIRECTS
#RewriteCond %{HTTP_HOST} ^xyz.com$ [OR]
#RewriteCond %{HTTP_HOST} ^www.xyz.com$
#RewriteRule ^support.html$ http://www.xyz.com/support [R=301,L]
RewriteRule ^support.html$ \/support [R=301,L]
RewriteCond %{HTTP_HOST} ^xyz.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xyz.com$
RewriteRule ^supportredirect$ "http\:\/\/www\.xyz\.com\/support" [R=301,L]
#################################################
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
# rs: removed "install" from list to accomodate conflict with mm install redirect
#
# Order allow,deny
#
Order allow,deny
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php index.cgi index.html index.htm
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.
# PHP 4, Apache 1.
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
# PHP 4, Apache 2.
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
php_value memory_limit 32M
# PHP 5, Apache 1 and 2.
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
# Requires mod_expires to be enabled.
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1
# Various rewrite rules.
# RewriteEngine on
# 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} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory 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 /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /
# Rewrite URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# $Id: .htaccess,v 1.90 2007/10/05 14:43:23 dries Exp $
# $Id: .htaccess,v 1.90.2.3 2008/12/10 20:04:08 goba Exp $
# Use PHP5 as default
# AddHandler application/x-httpd-php5 .php
#################################################
## end apache/drupal settings ##
#################################################
order allow,deny
deny from all
order allow,deny
allow from all
Comments
I've since figured out that
I've since figured out that the subdomains needed to have mod_rewrite turned off to not result in the 500. Still not sure what's going on with the infinite loop or where that's happening tho.
RewriteBase
I encountered this error just now on a virtualhost setup (Drupal 7.0). It's easy to forget to uncomment the
RewriteBase /
command in the .htaccess file...