You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by bu...@apache.org on 2012/05/05 12:03:03 UTC
[Bug 53196] New: Rewrite examples forget to encode the query string?
https://issues.apache.org/bugzilla/show_bug.cgi?id=53196
Priority: P2
Bug ID: 53196
Assignee: docs@httpd.apache.org
Summary: Rewrite examples forget to encode the query string?
Severity: normal
Classification: Unclassified
OS: Linux
Reporter: alan.christopher.jenkins@gmail.com
Hardware: PC
Status: NEW
Version: 2.4.1
Component: Documentation
Product: Apache httpd-2
httpd.apache.org/docs/2.4/rewrite/remapping.html#fallback-resource
"If, on the other hand, you wish to pass the requested URI as a query string
argument to index.php, you can replace that RewriteRule with:
RewriteRule (.*) index.php?$1 [PT,QSA]"
should be:
RewriteRule (.*) index.php?${encode:$1} [PT,QSA]
since RewriteRule matches against the *decoded* url path
(http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriterule).
That's the context I encountered the bug in. I think it applies to most of the
other remapping examples that use $1.
http://httpd.apache.org/docs/2.4/rewrite/remapping.html#backward-compatibility
http://httpd.apache.org/docs/2.4/rewrite/remapping.html#canonicalhost
http://httpd.apache.org/docs/2.4/rewrite/remapping.html#archive-access-multiplexer
http://httpd.apache.org/docs/2.4/rewrite/remapping.html#canonicalurl
Note that that this doesn't apply to rewrite rules which map to full filesystem
paths - i.e.
http://httpd.apache.org/docs/2.4/rewrite/remapping.html#multipledirs>
.
No idea what you're supposed to do with substitutions in Redirect directives;
it's not documented as supporting the ${encode:$1} syntax. Alias is fine
though (same reason as above).
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 53196] Rewrite examples forget to encode the query string?
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53196
Eric Covener <co...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Eric Covener <co...@gmail.com> ---
I don't think the examples should be complicated with encoding the capture
copied into the path or query string. There's ample coverage of the options in
the reference manual.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 53196] Rewrite examples forget to encode the query string?
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53196
--- Comment #2 from Alan <al...@gmail.com> ---
It looks like a much better solution would be to use the flag [B], to "escape
non-alphanumerics before applying the transformation". So this can be fixed
nicely.
Credit goes to <http://www.dracos.co.uk/code/apache-rewrite-problem/>.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 53196] Rewrite examples forget to encode the query string?
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53196
--- Comment #1 from Alan <al...@gmail.com> ---
Ah, I see my solution was missing a
RewriteMap encode int:escape
which means this wasn't as friendly as I thought: you can't use it in
.htaccess.
--
You are receiving this mail because:
You are the assignee for the bug.
[Bug 53196] Rewrite examples forget to encode the query string?
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53196
--- Comment #3 from Alan <al...@gmail.com> ---
...fixed nicely, that is, for the specific front-controller pattern in the
description. For everything else, it breaks, because '/' is non-alphanumeric
and apache refuses to handle %2F as a path separator. (Is that even legal?)
--
You are receiving this mail because:
You are the assignee for the bug.