DPI|discardpath
-The DPI flag causes the PATH_INFO portion of the rewritten URI to be
+
The DPI flag causes the PATH_INFO portion of the rewritten URL-path to be
discarded.
-In per-directory context, the URI each RewriteRule
-compares against is the concatenation of the current values of the URI
-and PATH_INFO.
-
-The current URI can be the initial URI as requested by the client, the
-result of a previous round of mod_rewrite processing, or the result of
-a prior rule in the current round of mod_rewrite processing.
-
-In contrast, the PATH_INFO that is appended to the URI before each
-rule reflects only the value of PATH_INFO before this round of
-mod_rewrite processing. As a consequence, if large portions
-of the URI are matched and copied into a substitution in multiple
+
+
In per-directory context,
+the URL-path each RewriteRule compares against
+is the concatenation of the current URL-path and PATH_INFO.
+
+The current URL-path can be the initial path as requested by the
+client, the result of a previous round of mod_rewrite
+processing, or the result of a prior rule in the current round of
+mod_rewrite processing.
+
+In contrast, the PATH_INFO that is appended to the URL-path before
+each rule reflects only the value of PATH_INFO before this round of
+mod_rewrite processing. As a consequence, if large
+portions of the URL-path are matched and copied into a substitution in multiple
RewriteRule directives, without regard for
which parts of the URI came from the current PATH_INFO, the final
-URI may have multiple copies of PATH_INFO appended to it.
+URL-path may have multiple copies of PATH_INFO appended to it.
Use this flag on any substitution where the PATH_INFO that resulted
from the previous mapping of this request to the filesystem is not of
@@ -310,6 +312,18 @@ not be recalculated until the current round of mod_rewrite proc
completes. Subsequent rules during this round of processing will see
only the direct result of substitutions, without any PATH_INFO
appended.
+
+
+# Request: /app/script.php/extra/path (PATH_INFO is /extra/path)
+# Without DPI, the substitution would see "script.php/extra/path"
+# and could inadvertently copy PATH_INFO into the result.
+RewriteRule "^script\.php(.*)$" "/new-app/handler$1" [DPI]
+
+
+The [DPI] flag discards /extra/path so that only the
+substitution result (/new-app/handler) is passed to
+subsequent rules or the final request.
+