summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2008-12-21 09:08:52 +0100
committerEric Covener <covener@apache.org>2008-12-21 09:08:52 +0100
commit04fde458e50fac13a38ec0a52efee4a94199acc8 (patch)
tree108cf708ad9f3f8e57ba599c1401267b726ddbfc
parentVarious cleanups and per-directory behavior differences (diff)
downloadapache2-04fde458e50fac13a38ec0a52efee4a94199acc8.tar.xz
apache2-04fde458e50fac13a38ec0a52efee4a94199acc8.zip
Update examples to be more per-directory agnostic, identify examples that
seem to be inherently per-directory oriented (REQUEST_URI vs REQUEST_FILENAME) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@728400 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--docs/manual/rewrite/rewrite_guide.html.en6
-rw-r--r--docs/manual/rewrite/rewrite_guide.xml6
-rw-r--r--docs/manual/rewrite/rewrite_guide_advanced.html.en8
-rw-r--r--docs/manual/rewrite/rewrite_guide_advanced.xml8
4 files changed, 20 insertions, 8 deletions
diff --git a/docs/manual/rewrite/rewrite_guide.html.en b/docs/manual/rewrite/rewrite_guide.html.en
index 9c29c21997..474ec64389 100644
--- a/docs/manual/rewrite/rewrite_guide.html.en
+++ b/docs/manual/rewrite/rewrite_guide.html.en
@@ -306,12 +306,12 @@ RewriteEngine on
# first try to find it in dir1/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_FILENAME} -f
+RewriteCond %{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_URI} -f
RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir1</strong>/$1 [L]
# second try to find it in dir2/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_FILENAME} -f
+RewriteCond %{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_URI} -f
RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir2</strong>/$1 [L]
# else go on for other Alias or ScriptAlias directives,
@@ -524,6 +524,8 @@ RewriteBase /~quux/
# parse out basename, but remember the fact
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
# rewrite to document.phtml if exists
+# Note: This is a per-directory example, so %{REQUEST_FILENAME} is the full
+# filesystem path as already mapped by the server.
RewriteCond %{REQUEST_FILENAME}.phtml -f
RewriteRule ^(.*)$ $1.phtml [S=1]
# else reverse the previous basename cutout
diff --git a/docs/manual/rewrite/rewrite_guide.xml b/docs/manual/rewrite/rewrite_guide.xml
index 2e2f0b9c1d..9c38a9bc9c 100644
--- a/docs/manual/rewrite/rewrite_guide.xml
+++ b/docs/manual/rewrite/rewrite_guide.xml
@@ -298,12 +298,12 @@ RewriteEngine on
# first try to find it in dir1/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_FILENAME} -f
+RewriteCond %{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_URI} -f
RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir1</strong>/$1 [L]
# second try to find it in dir2/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_FILENAME} -f
+RewriteCond %{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_URI} -f
RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir2</strong>/$1 [L]
# else go on for other Alias or ScriptAlias directives,
@@ -517,6 +517,8 @@ RewriteBase /~quux/
# parse out basename, but remember the fact
RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
# rewrite to document.phtml if exists
+# Note: This is a per-directory example, so %{REQUEST_FILENAME} is the full
+# filesystem path as already mapped by the server.
RewriteCond %{REQUEST_FILENAME}.phtml -f
RewriteRule ^(.*)$ $1.phtml [S=1]
# else reverse the previous basename cutout
diff --git a/docs/manual/rewrite/rewrite_guide_advanced.html.en b/docs/manual/rewrite/rewrite_guide_advanced.html.en
index 9087569538..3f976caa08 100644
--- a/docs/manual/rewrite/rewrite_guide_advanced.html.en
+++ b/docs/manual/rewrite/rewrite_guide_advanced.html.en
@@ -345,7 +345,7 @@ RewriteRule (.*) netsw-lsdir.cgi/$1
<div class="example"><pre>
RewriteEngine on
-RewriteCond /your/docroot/%{REQUEST_FILENAME} <strong>!-f</strong>
+RewriteCond %{DOCUMENT_ROOT/%{REQUEST_URI} <strong>!-f</strong>
RewriteRule ^(.+) http://<strong>webserverB</strong>.dom/$1
</pre></div>
@@ -575,7 +575,10 @@ RewriteRule ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1
through the proxy throughput feature:</p>
<div class="example"><pre>
-RewriteRule ^/~([^/]+)/?(.*) /home/$1/.www/$2
+RewriteRule ^/~([^/]+)/?(.*) /home/$1/.www/$2 [C]
+# REQUEST_FILENAME usage below is correct in this per-server context example
+# because the rule that references REQUEST_FILENAME is chained to a rule that
+# sets REQUEST_FILENAME.
RewriteCond %{REQUEST_FILENAME} <strong>!-f</strong>
RewriteCond %{REQUEST_FILENAME} <strong>!-d</strong>
RewriteRule ^/home/([^/]+)/.www/?(.*) http://<strong>www2</strong>.quux-corp.dom/~$1/pub/$2 [<strong>P</strong>]
@@ -850,6 +853,7 @@ HREF="*"
This is done via the following ruleset:
<div class="example"><pre>
+# This example is valid in per-directory context only
RewriteCond %{REQUEST_FILENAME} <strong>!-s</strong>
RewriteRule ^page\.<strong>html</strong>$ page.<strong>cgi</strong> [T=application/x-httpd-cgi,L]
</pre></div>
diff --git a/docs/manual/rewrite/rewrite_guide_advanced.xml b/docs/manual/rewrite/rewrite_guide_advanced.xml
index 81b026deb2..8534d9dadb 100644
--- a/docs/manual/rewrite/rewrite_guide_advanced.xml
+++ b/docs/manual/rewrite/rewrite_guide_advanced.xml
@@ -336,7 +336,7 @@ RewriteRule (.*) netsw-lsdir.cgi/$1
<example><pre>
RewriteEngine on
-RewriteCond /your/docroot/%{REQUEST_FILENAME} <strong>!-f</strong>
+RewriteCond %{DOCUMENT_ROOT/%{REQUEST_URI} <strong>!-f</strong>
RewriteRule ^(.+) http://<strong>webserverB</strong>.dom/$1
</pre></example>
@@ -568,7 +568,10 @@ RewriteRule ^http://www\.remotesite\.com/(.*)$ /mirror/of/remotesite/$1
through the proxy throughput feature:</p>
<example><pre>
-RewriteRule ^/~([^/]+)/?(.*) /home/$1/.www/$2
+RewriteRule ^/~([^/]+)/?(.*) /home/$1/.www/$2 [C]
+# REQUEST_FILENAME usage below is correct in this per-server context example
+# because the rule that references REQUEST_FILENAME is chained to a rule that
+# sets REQUEST_FILENAME.
RewriteCond %{REQUEST_FILENAME} <strong>!-f</strong>
RewriteCond %{REQUEST_FILENAME} <strong>!-d</strong>
RewriteRule ^/home/([^/]+)/.www/?(.*) http://<strong>www2</strong>.quux-corp.dom/~$1/pub/$2 [<strong>P</strong>]
@@ -845,6 +848,7 @@ HREF="*"
This is done via the following ruleset:
<example><pre>
+# This example is valid in per-directory context only
RewriteCond %{REQUEST_FILENAME} <strong>!-s</strong>
RewriteRule ^page\.<strong>html</strong>$ page.<strong>cgi</strong> [T=application/x-httpd-cgi,L]
</pre></example>