Use the WEBSITES > Redirect Rules page to define rules to redirect client requests to a specific URL or to a domain appending the requested URL for a selected Service:
A redirect rule consists of three patterns: host match, URL match, and extended match.
If there are multiple rules for a Service, the most specific host and URL match is executed. For example, if a Service has these two rules:
- Rule A -
host
www.home.com, URL /images/*
- Rule B -
host www.home.com, URL /images/*.png
and if the incoming request is for www.home.com/images/x.png
, then the most specific matching rule, which is Rule B, is executed. If a rule has the most specific host and URL for a request, any Extended Match expressions for that rule are evaluated in the order established by the Extended Match Order field. If the request does not match any Extended Match expression for the rule then the request is considered to have failed to match any rule.
You can include %s
in the URL to redirect to the domain (URL) specified appending the same requested URL. For example,
- Service:
http://www.home.com
- URL Match:
/*
- Redirect URL: http://www.redirect.com%s
When a request such as http://www.home.com/a.html
is sent, it is redirected to http://www.redirect.com/a.html
You can also use % in the URL to offset characters. For example,
- Service:
http://www.home.com/abc
- URL Match:
/*
- Redirect URL: http://www.redirect.com/test/*
If you use %s, the redirected URL would be http://www.redirect.com/test/abc instead of http://www.redirect.com/test/*.
In this case, specify the Redirect URL as http://www.redirect.com/%4s. This format will copy anything in the URL match after 4 characters.
Rule Key
Each redirect rule can be specified using a Rule key. The key is comprised of the URL, host and an optional extended match rule (that is, a value or expression for the header parameter). The matching Rule is determined by a best match algorithm using the host, URL and extended match fields in specified sequential order. In most cases, host and URL may only be used to specify a Rule. The Barracuda Load Balancer optimizes the search for the most common case by implementing a parallel search algorithm on all Rules. The best matching Rule is the Rule with closest matching host and URL keys. To configure a more complex Rule based on certain fields in the request such as a client IP or an HTTP header, use extended match rules. Not all extended match rules are considered for evaluation. Only the ones specified for the matching host and URL are used for evaluation. If more than one such rule is specified, they are evaluated based on the specified extended match sequence, and the lower the extended match sequence the higher the priority of the rule in the sequence.