Fortinet 384 FortiWeb 5.0 Patch 6 Administration Guide
are selected first in the URL rewriting group, before general ones, due to the affects of the
matching order on which each rewrite rule is applied.
See also
•Grouping rewriting & redirection rules
•Example: HTTP-to-HTTPS redirect
•Example: Rewriting URLs using variables
•Rewriting & redirecting
•Regular expression syntax
•What are back-references?
•Cookbook regular expressions
Example: Rewriting URLs using variablesExample.com has a web site that uses ASP, but the administrator wants it to appear that the
web site uses PHP. To do this, the administrator configured a rule that changes any requested
file's extension which is asp into php.
The condition table contains two match conditions, in this order:
1. The Host: may be anything.
2. The request URL must end in .asp.
If both of those are true, the request is rewritten.
The administrator does not want to rewrite matching requests into a single URL. Instead, the
administrator wants each rewritten URL to re-use parts of the original request.
To assemble the rewritten URL by re-using the original request’s file path and Host:, the
administrator uses two back reference variables: $0 and $1. Each variable refers to a part of the
Table 40:Example URL rewrites using regular expressions
Regular Expression in URL match
condition
URL Example URL in client’s request Result
^/cgi/python/ustore/payment.html$ /store/checkout /cgi/python/ustore/payment.html /store/checkout
^/ustore*$ /store/view /ustore/viewItem.asp?id=1&img=2 /store/view
/Wordpress/(.*) /blog/$0 /wordpress/10/11/24 /blog/10/11/24
/(.*)\.xml /$0 /index.xml /index