From: Christophe Jaillet
Date: Mon, 12 May 2014 20:50:34 +0000 (+0000)
Subject: Based on report from Ken Zalewski, on online doc.
X-Git-Tag: 2.4.10~244
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11acd83682c4208a2efef08a6648e3b8d1d50ee6;p=apache
Based on report from Ken Zalewski, on online doc.
Add missing Server-Variables useable in RewriteCond directive.
Introduced in r1132494
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT
Introduced in r737973
IPV6
Missing for ages!
SCRIPT_GROUP
SCRIPT_USER
I have added where I found it logical, feel free to adjust.
I have also reordered this table to ease reading.
Finally, I have beautified some tables at the end.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1594088 13f79535-47bb-0310-9956-ffa450edef68
---
diff --git a/docs/manual/mod/mod_rewrite.html.en b/docs/manual/mod/mod_rewrite.html.en
index ff2957cde6..accae8bca4 100644
--- a/docs/manual/mod/mod_rewrite.html.en
+++ b/docs/manual/mod/mod_rewrite.html.en
@@ -209,27 +209,30 @@ Alias /myapp /opt/myapp-1.2.3
- HTTP_USER_AGENT
- HTTP_REFERER
+ HTTP_ACCEPT
HTTP_COOKIE
HTTP_FORWARDED
HTTP_HOST
HTTP_PROXY_CONNECTION
- HTTP_ACCEPT
+ HTTP_REFERER
+ HTTP_USER_AGENT
|
- REMOTE_ADDR
+ AUTH_TYPE
CONN_REMOTE_ADDR
+ CONTEXT_PREFIX
+ CONTEXT_DOCUMENT_ROOT
+ IPV6
+ PATH_INFO
+ QUERY_STRING
+ REMOTE_ADDR
REMOTE_HOST
+ REMOTE_IDENT
REMOTE_PORT
REMOTE_USER
- REMOTE_IDENT
REQUEST_METHOD
SCRIPT_FILENAME
- PATH_INFO
- QUERY_STRING
- AUTH_TYPE
|
|
@@ -242,9 +245,11 @@ Alias /myapp /opt/myapp-1.2.3
DOCUMENT_ROOT
+ SCRIPT_GROUP
+ SCRIPT_USER
+ SERVER_ADDR
SERVER_ADMIN
SERVER_NAME
- SERVER_ADDR
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
@@ -263,14 +268,14 @@ Alias /myapp /opt/myapp-1.2.3
|
API_VERSION
- THE_REQUEST
- REQUEST_URI
- REQUEST_FILENAME
- IS_SUBREQ
+ CONN_REMOTE_ADDR
HTTPS
- REQUEST_SCHEME
+ IS_SUBREQ
REMOTE_ADDR
- CONN_REMOTE_ADDR
+ REQUEST_FILENAME
+ REQUEST_SCHEME
+ REQUEST_URI
+ THE_REQUEST
|
@@ -279,8 +284,8 @@ Alias /myapp /opt/myapp-1.2.3
correspond to the similarly named HTTP
MIME-headers, C variables of the Apache HTTP Server or
struct tm
fields of the Unix system.
- Most are documented elsewhere in the Manual or in
- the CGI specification.
+ Most are documented here
+ or elsewhere in the Manual or in the CGI specification.
SERVER_NAME and SERVER_PORT depend on the values of
UseCanonicalName
and
@@ -290,14 +295,6 @@ Alias /myapp /opt/myapp-1.2.3
Those that are special to mod_rewrite include those below.
- IS_SUBREQ
-
- - Will contain the text "true" if the request
- currently being processed is a sub-request,
- "false" otherwise. Sub-requests may be generated
- by modules that need to resolve additional files
- or URIs in order to complete their tasks.
-
API_VERSION
- This is the version of the Apache httpd module API
@@ -309,21 +306,30 @@ Alias /myapp /opt/myapp-1.2.3
instance, it is 19990320:10), but is mainly of
interest to module authors.
- THE_REQUEST
+ CONN_REMOTE_ADDR
- - The full HTTP request line sent by the
- browser to the server (e.g., "
GET
- /index.html HTTP/1.1
"). This does not
- include any additional headers sent by the
- browser. This value has not been unescaped
- (decoded), unlike most other variables below.
+ - Since 2.4.8: The peer IP address of the connection (see the
+
mod_remoteip
module).
- REQUEST_URI
+ HTTPS
- - The path component of the requested URI,
- such as "/index.html". This notably excludes the
- query string which is available as as its own variable
- named
QUERY_STRING
.
+ - Will contain the text "on" if the connection is
+ using SSL/TLS, or "off" otherwise. (This variable
+ can be safely used regardless of whether or not
+
mod_ssl
is loaded).
+
+ IS_SUBREQ
+
+ - Will contain the text "true" if the request
+ currently being processed is a sub-request,
+ "false" otherwise. Sub-requests may be generated
+ by modules that need to resolve additional files
+ or URIs in order to complete their tasks.
+
+ REMOTE_ADDR
+
+ - The IP address of the remote host (see the
+
mod_remoteip
module).
REQUEST_FILENAME
@@ -338,26 +344,27 @@ Alias /myapp /opt/myapp-1.2.3
REQUEST_URI
to map the request to a file.
- HTTPS
-
- - Will contain the text "on" if the connection is
- using SSL/TLS, or "off" otherwise. (This variable
- can be safely used regardless of whether or not
-
mod_ssl
is loaded).
-
REQUEST_SCHEME
- Will contain the scheme of the request (usually
"http" or "https"). This value can be influenced with
ServerName
.
- REMOTE_ADDR
- - The IP address of the remote host (see the
-
mod_remoteip
module).
+ REQUEST_URI
- CONN_REMOTE_ADDR
- - Since 2.4.8: The peer IP address of the connection (see the
-
mod_remoteip
module).
+ - The path component of the requested URI,
+ such as "/index.html". This notably excludes the
+ query string which is available as as its own variable
+ named
QUERY_STRING
.
+
+ THE_REQUEST
+
+ - The full HTTP request line sent by the
+ browser to the server (e.g., "
GET
+ /index.html HTTP/1.1
"). This does not
+ include any additional headers sent by the
+ browser. This value has not been unescaped
+ (decoded), unlike most other variables below.
@@ -1171,129 +1178,128 @@ cannot use $N
in the substitution string!
brackets, of any of the flags in the following table. More
details, and examples, for each flag, are available in the Rewrite Flags document.
-
- Flag and syntax |
+
-
+
B |
Escape non-alphanumeric characters before applying
the transformation. details ... |
-
+
chain|C |
Rule is chained to the following rule. If the rule fails,
the rule(s) chained to it will be skipped. details ... |
-
+
cookie|CO=NAME:VAL |
Sets a cookie in the client browser. Full syntax is:
CO=NAME:VAL:domain[:lifetime[:path[:secure[:httponly]]]] details ...
|
-
+
discardpath|DPI |
Causes the PATH_INFO portion of the rewritten URI to be
discarded. details
... |
-
+
END |
Stop the rewriting process immediately and don't apply any
more rules. Also prevents further execution of rewrite rules
in per-directory and .htaccess context. (Available in 2.3.9 and later)
details ... |
-
+
env|E=[!]VAR[:VAL] |
Causes an environment variable VAR to be set (to the
value VAL if provided). The form !VAR causes
the environment variable VAR to be unset.
details ... |
-
+
forbidden|F |
Returns a 403 FORBIDDEN response to the client browser.
details ... |
-
+
gone|G |
Returns a 410 GONE response to the client browser. details ... |
-
+
Handler|H=Content-handler |
Causes the resulting URI to be sent to the specified
Content-handler for processing. details ... |
-
+
last|L |
Stop the rewriting process immediately and don't apply any
more rules. Especially note caveats for per-directory and
.htaccess context (see also the END flag). details ... |
-
+
next|N |
Re-run the rewriting process, starting again with the first
rule, using the result of the ruleset so far as a starting
point. details
... |
-
+
nocase|NC |
Makes the pattern comparison case-insensitive.
details ... |
-
+
noescape|NE |
Prevent mod_rewrite from applying hexcode escaping of
special characters in the result of the rewrite. details ... |
-
+
nosubreq|NS |
Causes a rule to be skipped if the current request is an
internal sub-request. details ... |
-
+
proxy|P |
Force the substitution URL to be internally sent as a proxy
request. details
... |
-
+
passthrough|PT |
Forces the resulting URI to be passed back to the URL
mapping engine for processing of other URI-to-filename
translators, such as Alias or
Redirect . details ... |
-
+
qsappend|QSA |
Appends any query string from the original request URL to
any query string created in the rewrite target.details ... |
-
+
qsdiscard|QSD |
Discard any query string attached to the incoming URI.
details
... |
-
+
redirect|R[=code] |
Forces an external redirect, optionally with the specified
HTTP status code. details ...
|
-
+
skip|S=num |
Tells the rewriting engine to skip the next num
rules if the current rule matches. details ... |
-
+
type|T=MIME-type |
Force the MIME-type of the target file
to be the specified type. details ... |
-
+
---|
Home directory expansion
When the substitution string begins with a string
@@ -1316,68 +1322,55 @@ directive.
/somepath/pathinfo'':
-
-
+
-
^/somepath(.*) otherpath$1 |
invalid, not supported |
-
-
+
^/somepath(.*) otherpath$1 [R] |
invalid, not supported |
-
^/somepath(.*) otherpath$1 [P] |
invalid, not supported |
-
-
+
^/somepath(.*) /otherpath$1 |
/otherpath/pathinfo |
-
^/somepath(.*) /otherpath$1 [R] |
http://thishost/otherpath/pathinfo via external redirection |
-
-
+
^/somepath(.*) /otherpath$1 [P] |
doesn't make sense, not supported |
-
^/somepath(.*) http://thishost/otherpath$1 |
/otherpath/pathinfo |
-
-
+
^/somepath(.*) http://thishost/otherpath$1 [R] |
http://thishost/otherpath/pathinfo via external redirection |
-
^/somepath(.*) http://thishost/otherpath$1 [P] |
doesn't make sense, not supported |
-
-
+
^/somepath(.*) http://otherhost/otherpath$1 |
http://otherhost/otherpath/pathinfo via external redirection |
-
^/somepath(.*) http://otherhost/otherpath$1 [R] |
http://otherhost/otherpath/pathinfo via external redirection (the [R] flag is redundant) |
-
-
+
^/somepath(.*) http://otherhost/otherpath$1 [P] |
http://otherhost/otherpath/pathinfo via internal proxy |
@@ -1391,74 +1384,59 @@ directive.
/somepath/localpath/pathinfo'':
-
-
-
+
-
^localpath(.*) otherpath$1 |
/somepath/otherpath/pathinfo |
-
-
+
^localpath(.*) otherpath$1 [R] |
http://thishost/somepath/otherpath/pathinfo via external
redirection |
-
^localpath(.*) otherpath$1 [P] |
doesn't make sense, not supported |
-
-
+
^localpath(.*) /otherpath$1 |
/otherpath/pathinfo |
-
^localpath(.*) /otherpath$1 [R] |
http://thishost/otherpath/pathinfo via external redirection |
-
-
+
^localpath(.*) /otherpath$1 [P] |
doesn't make sense, not supported |
-
^localpath(.*) http://thishost/otherpath$1 |
/otherpath/pathinfo |
-
-
+
^localpath(.*) http://thishost/otherpath$1 [R] |
http://thishost/otherpath/pathinfo via external redirection |
-
^localpath(.*) http://thishost/otherpath$1 [P] |
doesn't make sense, not supported |
-
-
+
^localpath(.*) http://otherhost/otherpath$1 |
http://otherhost/otherpath/pathinfo via external redirection |
-
^localpath(.*) http://otherhost/otherpath$1 [R] |
http://otherhost/otherpath/pathinfo via external redirection (the [R] flag is redundant) |
-
-
+
^localpath(.*) http://otherhost/otherpath$1 [P] |
http://otherhost/otherpath/pathinfo via internal proxy |
-
diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml
index d2e1f021dc..7ee7fd1f17 100644
--- a/docs/manual/mod/mod_rewrite.xml
+++ b/docs/manual/mod/mod_rewrite.xml
@@ -465,27 +465,30 @@ Alias /myapp /opt/myapp-1.2.3
- HTTP_USER_AGENT
- HTTP_REFERER
+ HTTP_ACCEPT
HTTP_COOKIE
HTTP_FORWARDED
HTTP_HOST
HTTP_PROXY_CONNECTION
- HTTP_ACCEPT
+ HTTP_REFERER
+ HTTP_USER_AGENT
|
- REMOTE_ADDR
+ AUTH_TYPE
CONN_REMOTE_ADDR
+ CONTEXT_PREFIX
+ CONTEXT_DOCUMENT_ROOT
+ IPV6
+ PATH_INFO
+ QUERY_STRING
+ REMOTE_ADDR
REMOTE_HOST
+ REMOTE_IDENT
REMOTE_PORT
REMOTE_USER
- REMOTE_IDENT
REQUEST_METHOD
SCRIPT_FILENAME
- PATH_INFO
- QUERY_STRING
- AUTH_TYPE
|
|
@@ -498,9 +501,11 @@ Alias /myapp /opt/myapp-1.2.3
DOCUMENT_ROOT
+ SCRIPT_GROUP
+ SCRIPT_USER
+ SERVER_ADDR
SERVER_ADMIN
SERVER_NAME
- SERVER_ADDR
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
@@ -519,14 +524,14 @@ Alias /myapp /opt/myapp-1.2.3
|
API_VERSION
- THE_REQUEST
- REQUEST_URI
- REQUEST_FILENAME
- IS_SUBREQ
+ CONN_REMOTE_ADDR
HTTPS
- REQUEST_SCHEME
+ IS_SUBREQ
REMOTE_ADDR
- CONN_REMOTE_ADDR
+ REQUEST_FILENAME
+ REQUEST_SCHEME
+ REQUEST_URI
+ THE_REQUEST
|
@@ -535,8 +540,8 @@ Alias /myapp /opt/myapp-1.2.3
correspond to the similarly named HTTP
MIME-headers, C variables of the Apache HTTP Server or
struct tm
fields of the Unix system.
- Most are documented elsewhere in the Manual or in
- the CGI specification.
+ Most are documented here
+ or elsewhere in the Manual or in the CGI specification.
SERVER_NAME and SERVER_PORT depend on the values of
UseCanonicalName and
@@ -546,14 +551,6 @@ Alias /myapp /opt/myapp-1.2.3
Those that are special to mod_rewrite include those below.
- IS_SUBREQ
-
- - Will contain the text "true" if the request
- currently being processed is a sub-request,
- "false" otherwise. Sub-requests may be generated
- by modules that need to resolve additional files
- or URIs in order to complete their tasks.
-
API_VERSION
- This is the version of the Apache httpd module API
@@ -565,21 +562,30 @@ Alias /myapp /opt/myapp-1.2.3
instance, it is 19990320:10), but is mainly of
interest to module authors.
- THE_REQUEST
+ CONN_REMOTE_ADDR
- - The full HTTP request line sent by the
- browser to the server (e.g., "
GET
- /index.html HTTP/1.1
"). This does not
- include any additional headers sent by the
- browser. This value has not been unescaped
- (decoded), unlike most other variables below.
+ - Since 2.4.8: The peer IP address of the connection (see the
+ mod_remoteip module).
- REQUEST_URI
+ HTTPS
- - The path component of the requested URI,
- such as "/index.html". This notably excludes the
- query string which is available as as its own variable
- named
QUERY_STRING
.
+ - Will contain the text "on" if the connection is
+ using SSL/TLS, or "off" otherwise. (This variable
+ can be safely used regardless of whether or not
+ mod_ssl is loaded).
+
+ IS_SUBREQ
+
+ - Will contain the text "true" if the request
+ currently being processed is a sub-request,
+ "false" otherwise. Sub-requests may be generated
+ by modules that need to resolve additional files
+ or URIs in order to complete their tasks.
+
+ REMOTE_ADDR
+
+ - The IP address of the remote host (see the
+ mod_remoteip module).
REQUEST_FILENAME
@@ -594,26 +600,27 @@ Alias /myapp /opt/myapp-1.2.3
REQUEST_URI
to map the request to a file.
- HTTPS
-
- - Will contain the text "on" if the connection is
- using SSL/TLS, or "off" otherwise. (This variable
- can be safely used regardless of whether or not
- mod_ssl is loaded).
-
REQUEST_SCHEME
- Will contain the scheme of the request (usually
"http" or "https"). This value can be influenced with
ServerName.
- REMOTE_ADDR
- - The IP address of the remote host (see the
- mod_remoteip module).
+ REQUEST_URI
- CONN_REMOTE_ADDR
- - Since 2.4.8: The peer IP address of the connection (see the
- mod_remoteip module).
+ - The path component of the requested URI,
+ such as "/index.html". This notably excludes the
+ query string which is available as as its own variable
+ named
QUERY_STRING
.
+
+ THE_REQUEST
+
+ - The full HTTP request line sent by the
+ browser to the server (e.g., "
GET
+ /index.html HTTP/1.1
"). This does not
+ include any additional headers sent by the
+ browser. This value has not been unescaped
+ (decoded), unlike most other variables below.
@@ -1185,7 +1192,7 @@ cannot use $N
in the substitution string!
details, and examples, for each flag, are available in the Rewrite Flags document.
-
+
Flag and syntax |
Function |
@@ -1342,7 +1349,7 @@ directive.
/somepath/pathinfo'':
-
+
Given Rule |
Resulting Substitution |
@@ -1417,7 +1424,7 @@ directive.
/somepath/localpath/pathinfo'':
-