Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by slive: http://wiki.apache.org/httpd/Recipes/QueryString The comment on the change is: Be even more strict for security reasons. ------------------------------------------------------------------------------ === Making the Query String Part of the Path === - Take a URL of the form {{{http://example.com/path?var=val}}} and transform it into {{{http://example.com/path/var/val}}}. Note that this will work only for a single key=value pair. + Take a URL of the form {{{http://example.com/path?var=val}}} and transform it into {{{http://example.com/path/var/val}}}. Note that this will work only for a single key=value pair containing only letters, numbers, and the underscore character. {{{ - RewriteCond %{QUERY_STRING} ^(.*)=(.*)$ + RewriteCond %{QUERY_STRING} ^(\w+)=(\w+)$ RewriteRule ^/path /path/%1/%2 }}} @@ -58, +58 @@ Essentially the reverse of the above recipe. {{{ - RewriteRule ^/path/(.*)/(.*) /path?$1=$2 + RewriteRule ^/path/(\w+)/(\w+) /path?$1=$2 }}} - Another take on this example could be the following: - - {{{ - RewriteRule ^/path/([^/]+)/([^/]+) /path?$1=$2 - }}} - - Which serves the same basic purpose, but changing {{{.*}}} to {{{[^/]+}}} ensures that there is something between the / characters, is more explicit, probably faster (not sure about this one though), and, at the very least, serves as a better starting point to modify if your conditions are more complex. -
