Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 61137 invoked from network); 10 Sep 2003 12:22:01 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 10 Sep 2003 12:22:01 -0000 Received: (qmail 47112 invoked by uid 500); 10 Sep 2003 12:21:41 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 47093 invoked by uid 500); 10 Sep 2003 12:21:40 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 47080 invoked from network); 10 Sep 2003 12:21:40 -0000 Received: from unknown (HELO sonny.siteprotect.com) (64.26.0.85) by daedalus.apache.org with SMTP; 10 Sep 2003 12:21:40 -0000 Received: from petmystone.com ([4.21.127.47]) by sonny.siteprotect.com (8.11.6/8.11.6) with ESMTP id h8ACLeZ27658 for ; Wed, 10 Sep 2003 07:21:41 -0500 Message-ID: <3F5F1783.50707@petmystone.com> Date: Wed, 10 Sep 2003 08:22:27 -0400 From: Timothy Stone Reply-To: tstone@cityofhbg.com Organization: City of Harrisburg, PA User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: users@httpd.apache.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Subject: [users@httpd] In Rewrite Loop -- please help X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N List, I'm running Apache 2.0.46 on Windows 2000 SP 2. I have five domains, all variations on a theme (all examples): www.mycity.com www.mycity.org www.mycity.net www.mycityevents.com www.mycitystate.gov All five domains are entered in DNS identically for round robin load sharing. Currently, www.mycity.com, acts as the "primary" domain for all of these domains. So a client requesting .org|.net|.gov are immediately redirected (R=permanent) to "dot-com" via a RewriteRule (conf follows) in a virtual host. Now, it has been decided that the "dot-gov" address will act as the primary domain. It might seem as simple as editing the ServerName, ServerAlias and appropiate RewriteRule and RewriteConds, but alas, no. It sends me into a loop, which can be seen in the RewriteLog; it kills the client but, fortunately, Apache gracefully handles it (a recent fix in the 2.0.4x series I believe). I edit the conf (shown below in "Broken, Loopy Conf") changing very little, it nearly amounts to: s/city\.com/citystate\.gov/g Both working and broken httpd.conf follow, edited of course. Any suggestions on what could be causing this loop would be very helpful. I'm too close at this point to see anything wrong I think. ***** WORKING CONF **** # Section 1: Global Configuration Listen 80 # Section 2: Main Server Configuration ... # If this is not set to valid DNS name for your host, server-generated # redirections will not work. See also the UseCanonicalName directive. ... ServerName www.mycity.com:80 # UseCanonicalName: Determines how Apache constructs self-referencing # URLs and the SERVER_NAME and SERVER_PORT variables. # When set "Off", Apache will use the Hostname and Port supplied # by the client. When set "On", Apache will use the value of the # ServerName directive. # UseCanonicalName Off ### Section 3: Virtual Hosts NameVirtualHost * # main vhost ServerName www.mycity.com ServerAlias mycity.com *.mycity.com DocumentRoot "C:/usr/local/apache2-01/htdocs/mycity" RewriteEngine on RewriteCond %{HTTP_HOST} !^www.mycity.com [nocase] [OR] #For internal use, prevents images from being blocked RewriteCond %{HTTP_HOST} !^10\.* RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.mycity.com/$1 [R=permanent] RewriteLog logs/rewrite.log RewriteLogLevel 0 ServerName www.mycityevents.com ServerAlias mycityevents.com *.mycityevents.com DocumentRoot "C:/usr/local/apache2-01/htdocs/mycity" RewriteEngine on RewriteCond %{HTTP_HOST} ^www.mycityevents.com [nocase] RewriteRule ^/(.*) http://www.mycityevents.com/rec/ [R=permanent] RewriteLog logs/rewrite_rec.log RewriteLogLevel 9 ***** BROKEN, LOOPY CONF **** * recall, i'm simply trying to change the rewrite rule, but I'm also changing the server name because this is now the "primary" domain. ### Section 1: Global Configuration Listen 80 ### Section 2: Main Server Configuration ... # If this is not set to valid DNS name for your host, server-generated # redirections will not work. See also the UseCanonicalName directive. ... ServerName www.mycitystate.gov:80 # UseCanonicalName: Determines how Apache constructs self-referencing # URLs and the SERVER_NAME and SERVER_PORT variables. # When set "Off", Apache will use the Hostname and Port supplied # by the client. When set "On", Apache will use the value of the # ServerName directive. # UseCanonicalName Off ### Section 3: Virtual Hosts NameVirtualHost * ServerName www.mycitystate.gov ServerAlias mycitystate.gov *.mycitystate.gov DocumentRoot "C:/usr/local/apache2-01/htdocs/mycity" RewriteEngine on RewriteCond %{HTTP_HOST} !^www.mycitystate.gov [nocase] [OR] #For internal use, prevents images from being blocked RewriteCond %{HTTP_HOST} !^10\.* RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.mycitystate.gov/$1 [R=permanent] RewriteLog logs/rewrite.log RewriteLogLevel 0 ServerName www.mycityevents.com ServerAlias mycityevents.com *.mycityevents.com DocumentRoot "C:/usr/local/apache2-01/htdocs/mycity" RewriteEngine on RewriteCond %{HTTP_HOST} ^www.mycityevents.com [nocase] RewriteRule ^/(.*) http://www.mycityevents.gov/rec/ [R=permanent] RewriteLog logs/rewrite_rec.log RewriteLogLevel 0 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org