summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/libh2o/srcdoc/configure/redirect_directives.mt
blob: 8fbdd957800f1997c0d0468c61dda7fdb10af371 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
? my $ctx = $main::context;
? $_mt->wrapper_file("wrapper.mt", "Configure", "Redirect Directives")->(sub {

<p>
This document describes the configuration directives of the redirect handler.
</p>

<?
$ctx->{directive}->(
    name      => "redirect",
     levels    => [ qw(path) ],
     desc      => q{Redirects the requests to given URL.},
)->(sub {
?>
<p>
The directive rewrites the URL by replacing the host and path part of the URL at which the directive is used with the given URL.  For example, when using the configuration below, requests to <code>http://example.com/abc.html</code> will be redirected to <code>https://example.com/abc.html</code>.
</p>
<p>
If the argument is a scalar, the value is considered as the URL to where the requests should be redirected.
</p>
<p>
Following properties are recognized if the argument is a mapping.
<dl>
<dt><code>url</code>
<dd>URL to redirect to
<dt><code>status</code>
<dd>the three-digit status code to use (e.g. <code>301</code>)
<dt><code>internal</code>
<dd>either <code>YES</code> or <code>NO</code> (default); if set to <code>YES</code>, then the server performs an internal redirect and return the content at the redirected URL
</dl>
</p>
<?= $ctx->{example}->('Redirect all HTTP to HTTPS permanently (except for the files under <code>RSS</code>)', <<'EOT');
hosts:
    "example.com:80":
        paths:
            "/":
                redirect:
                    status: 301
                    url:    "https://example.com/"
            "/rss":
                file.dir: /path/to/rss
EOT
?>

? })

? })