diff options
author | Rich Bowen <rbowen@apache.org> | 2009-11-27 18:27:26 +0000 |
---|---|---|
committer | Rich Bowen <rbowen@apache.org> | 2009-11-27 18:27:26 +0000 |
commit | 3d05ffe29ef42cddd6696aa259d70f24244bc484 (patch) | |
tree | b800f7325c103d7dbd0cb81c3f4b3960482f563b /docs/manual/vhosts/mass.html.en | |
parent | c195b5231baad8b74682c7af63afb1c4c301266a (diff) | |
download | httpd-3d05ffe29ef42cddd6696aa259d70f24244bc484.tar.gz |
Replaces the two-step process with a single rule using the RewriteCond
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
Diffstat (limited to 'docs/manual/vhosts/mass.html.en')
-rw-r--r-- | docs/manual/vhosts/mass.html.en | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/docs/manual/vhosts/mass.html.en b/docs/manual/vhosts/mass.html.en index a71d154eef..445c4e6ab2 100644 --- a/docs/manual/vhosts/mass.html.en +++ b/docs/manual/vhosts/mass.html.en @@ -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/ |