Index: [Article Count Order] [Thread]

Date:  Sun, 18 Mar 2007 02:06:37 -0600
From:  Michael Best <mbest (at mark) pendragon.org>
Subject:  [coba-e:09223] Annoyed with Canonicalizing of domain names
To:  coba-e (at mark) bluequartz.org
Message-Id:  <45FCF30D.3090303 (at mark) pendragon.org>
X-Mail-Count: 09223

I was annoyed that when I set up a domain and gave it an alias that the 
RewriteRule/Redirect that is default in the domain would not allow you 
to visit the site by one of it's aliased names.  So I wrote a patch.  I 
tried to think of a more elegant way to do this, but this works for me.

--- /usr/sausalito/perl/Base/Httpd.pm.orig      2007-03-18 
07:06:33.000000000 -0400
+++ /usr/sausalito/perl/Base/Httpd.pm   2007-03-18 07:58:25.000000000 -0400
@@ -864,11 +864,31 @@
     # ServerAlias lines
     while (<$in>)
     {
+
+        if (/^RewriteCond/)
+       {
+
+         if (/^.*# Alias$/)
+          {
+            next;
+          }
+       }
+
+       if (/^RewriteRule/)
+       {
+         for my $alias (@{$aliases})
+         {
+            print $out "RewriteCond %{HTTP_HOST}                
!^$alias(:80)?\$ [NC] # Alias\n";
+         }
+       }
+
        if (/^ServerAlias/)
        {
            next;
        }

+
+
        print $out $_;
     }