Advanced Rule
Overview
This type of rule will present you with three input fields and a couple of checkboxes, namely:
- Description - Conditions - From - To - Case Sensitive - Type - Use Wildcard Matching - Process other rules - Append querystring
Description
This field is meant to provide a clear description of the rule, so it's clear for other people what it does and why it was created. This will also help you to find it later using the search.
Conditions
These conditions must match for this rule to be processed.
From
Here you can enter the regular expression that the incoming URL will be matched against. (Assuming 'Use Wildcard Matching' is unchecked, see below)
To
What the matched part of the URL will be rewritten to, all other parts of the URL will remain intact. It can contain backreferences, variables and functions.
Backreference | Explanation |
---|---|
$N | Provides access to the grouped parts (parentheses) of the pattern from the 'From' field. |
%N | Provides access to the grouped parts (parentheses) of the pattern from the last matched Condition in the current rule. |
Variable | Example |
---|---|
???scheme??? | Will return either http or https. Any valid condition type can be used as a variable name. |
Function | Example | Example would return |
---|---|---|
replace | ${replace:my cat is a blue cat:cat:dog} | my dog is a blue dog |
replaceFirst | ${replaceFirst:my cat is a blue cat:cat:dog} | my dog is a blue cat |
escape | ${escape:a b c} | a+b+c |
unescape | ${unescape:a+b+c} | a b c |
lower | ${lower:Hello World} | hello world |
upper | ${upper:hello} | HELLO |
trim | ${trim: abc def } | abc def |
Case Sensitive
Tick this checkbox to take the case of the URL that is matched into account.
Type
What type of redirect should take place.
Rule Type | HTTP status code |
---|---|
temporary-redirect | Redirect with 302 response code |
permanent-redirect | Redirect with 301 response code |
forward | Requests matching the "conditions" for this "rule", and the URL in the "from" element will be internally forwarded to the URL specified in the "to" element. |
redirect | Requests matching the "conditions" and the "from" for this rule will be HTTP redirected |
pre-include | |
post-include | |
proxy | The request will be proxied to the full url specified |
Use Wildcard Matching
Use wildcard matching instead of regular expressions. A single wildcard (*) will match any single element, ** will match all elements. See Standard Rule for some examples.
Process Other Rules
Other rules will be processed after this one succeeds, same as not specifying the 'last' flag for Apache HTTPD mod_rewrite.
Append Query String
If this option is checked, the query string of the matched URL (field 'Rewrite From') is kept in the rewritten URL.
A known issue regarding missing question mark separator: the software behind the URL Rewriter has a known issue that the question mark is not present in the rewritten URL. The workaround is to have the question mark already at the end of the field 'Rewrite To'.