Logo address

URI redirection (2)

目次

Location

	$web/etc/rewrite

Description

This file is used to give valid URI to the client.
URI redirection takes two steps. The first is by /sys/lib/httpd.rewrite and the second is by $web/etc/rewrite. The former is managed by the server administrator and the latter, by the document administrator.

The first field is a path from document root, therefore

The format allowed in second field is one of:
where [ ] is meta symbol that denote inside of these symbol can be omitted and
The matched portion is replaced by the string of second field. See also path matching.

Redirection loop

Let's consider about
/private		https://pegasus.goodwill.com/private
that appeared in case study of /sys/lib/httpd.rewrite.
Why bob wrote such a line? He wanted to use https for /private.
Request will come at first time with http://pegasus.goodwill.com/private. The request will then be redirected to https://pegasus.goodwill.com/private. The client will make a second request https://pegasus.goodwill.com/private. What will happen then?
If server redirects the request to https://pegasus.goodwill.com/private, then the redirection will fall into infinite loop! Therefore Pegasus does not redirect the request and simply accept as a request of this URI.
The expression of redirection loop is allowed only in $web/etc/rewrite, not in /sys/lib/httpd.rewrite. And the loop must be closed in a single line.