]> granicus.if.org Git - apache/commitdiff
Replaces the two-step process with a single rule using the RewriteCond
authorRich Bowen <rbowen@apache.org>
Fri, 27 Nov 2009 18:27:26 +0000 (18:27 +0000)
committerRich Bowen <rbowen@apache.org>
Fri, 27 Nov 2009 18:27:26 +0000 (18:27 +0000)
backreference. This technique is far simpler, and far easier to explain
to beginners than the unnecessarily complicated technique used.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@884943 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/vhosts/mass.html.en
docs/manual/vhosts/mass.xml
docs/manual/vhosts/mass.xml.ko
docs/manual/vhosts/mass.xml.tr

index a71d154eeff01274b5d82468395219cef620b749..445c4e6ab227df2763f930449c3f846339f1684b 100644 (file)
@@ -356,8 +356,10 @@ RewriteRule  ^/(.*)$  /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1  [H=cgi-
 <h2><a name="homepages.rewrite" id="homepages.rewrite">A
     Homepages System Using <code>mod_rewrite</code></a></h2>
 
-    <p>This does the same thing as <a href="#homepages">the second
-    example</a>.</p>
+    <p>This is similar to <a href="#homepages">the one above</a>,
+    but also verifies that the hostname falls into a specific subset of
+    hostnames - in this case, that it looks like
+    <code>www.<strong>SITE</strong>.example.com</code>.</p>
 
 <div class="example"><p><code>
 RewriteEngine on<br />
@@ -367,15 +369,11 @@ RewriteMap   lowercase  int:tolower<br />
 # allow CGIs to work<br />
 RewriteCond  %{REQUEST_URI}  !^/cgi-bin/<br />
 <br />
-# check the hostname is right so that the RewriteRule works<br />
-RewriteCond  ${lowercase:%{SERVER_NAME}}  ^www\.[a-z-]+\.isp\.com$<br />
+# Capture the site name in the backreference variable %1<br />
+RewriteCond  ${lowercase:%{SERVER_NAME}}  ^www\.([a-z-]+)\.example\.com$<br />
 <br />
-# concatenate the virtual host name onto the start of the URI<br />
-# the [C] means do the next rewrite on the result of this one<br />
-RewriteRule  ^(.+)  ${lowercase:%{SERVER_NAME}}$1  [C]<br />
-<br />
-# now create the real file name<br />
-RewriteRule  ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2<br />
+# Map the request to the site's document directory<br />
+RewriteRule  ^(.*) /home/%1/$1<br />
 <br />
 # define the global CGI directory<br />
 ScriptAlias  /cgi-bin/  /www/std-cgi/
index 9e9c739fffb730441e7a24fc93d942251c187df5..2107056c73a04cd67d9a2a637595e2c70ed02909 100644 (file)
@@ -349,8 +349,10 @@ RewriteRule  ^/(.*)$  /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1  [H=cgi-
 <section id="homepages.rewrite"><title>A
     Homepages System Using <code>mod_rewrite</code></title>
 
-    <p>This does the same thing as <a href="#homepages">the second
-    example</a>.</p>
+    <p>This is similar to <a href="#homepages">the one above</a>,
+    but also verifies that the hostname falls into a specific subset of
+    hostnames - in this case, that it looks like
+    <code>www.<strong>SITE</strong>.example.com</code>.</p>
 
 <example>
 RewriteEngine on<br />
@@ -360,15 +362,11 @@ RewriteMap   lowercase  int:tolower<br />
 # allow CGIs to work<br />
 RewriteCond  %{REQUEST_URI}  !^/cgi-bin/<br />
 <br />
-# check the hostname is right so that the RewriteRule works<br />
-RewriteCond  ${lowercase:%{SERVER_NAME}}  ^www\.[a-z-]+\.isp\.com$<br />
+# Capture the site name in the backreference variable %1<br />
+RewriteCond  ${lowercase:%{SERVER_NAME}}  ^www\.([a-z-]+)\.example\.com$<br />
 <br />
-# concatenate the virtual host name onto the start of the URI<br />
-# the [C] means do the next rewrite on the result of this one<br />
-RewriteRule  ^(.+)  ${lowercase:%{SERVER_NAME}}$1  [C]<br />
-<br />
-# now create the real file name<br />
-RewriteRule  ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2<br />
+# Map the request to the site's document directory<br />
+RewriteRule  ^(.*) /home/%1/$1<br />
 <br />
 # define the global CGI directory<br />
 ScriptAlias  /cgi-bin/  /www/std-cgi/
index f88136f17db70456021d8f2d440fdf6c9694b505..91b22b9176c955287f6fa096730c7d7ad6808720 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version='1.0' encoding='EUC-KR' ?>
 <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
 <?xml-stylesheet type="text/xsl" href="../style/manual.ko.xsl"?>
-<!-- English Revision: 151408:884925 (outdated) -->
+<!-- English Revision: 151408:884934 (outdated) -->
 
 <!--
  Licensed to the Apache Software Foundation (ASF) under one or more
index a31432a622d8feece1881441f5516437eedba2ee..9a3e23724e96f02a1efb9baf38ff6de42eed9bbc 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version='1.0' encoding='UTF-8' ?>
 <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
 <?xml-stylesheet type="text/xsl" href="../style/manual.tr.xsl"?>
-<!-- English Revision: 659902:884925 (outdated) -->
+<!-- English Revision: 659902:884934 (outdated) -->
 <!-- =====================================================
  Translated by: Nilgün Belma Bugüner <nilgun belgeler.org>
    Reviewed by: Orhan Berent <berent belgeler.org>