New upstream release
[pkg-ocaml-ocsigen.git] / doc / manual-wiki / redirectmod.wiki
blob1b7279789f66e562a751e4007ecf66267975d038
1 =Redirectmod=
3 Redirectmod is a module allowing to define HTTP redirections from Ocsigen's configuration file. It is in beta version. Submit your bugs and feature wishes (or any enhancement/mistake in the documentation) [[site:trac|here]].
5 To use that extension, first load it from the configuration file:
6 {{{
7 <extension findlib-package="ocsigenserver.ext.redirectmod"/>
8 }}}
9 Then configure your hosts as in these examples:
10 {{{
11 <redirect suburl="(.*)" dest="http://my.newaddress.org/\1"/>
12 <redirect suburl="dir/(.*)\.html" dest="http://my.newaddress.org/\1.php"/>
13 <redirect fullurl="http://(.*).myserver.org/(.*)" dest="http://\1.mynewserver.org/\2"/>
14 }}}
15 The syntax of regular expression is PCRE's one.
16 //Warning: the syntax recently changed from {{{$i}}} to {{{\i}}}.//
18 According to the RFC of the HTTP protocol, dest must be an absolute URL. By default, the redirection is permanent. For temporary redirection, use:
19 {{{
20 <redirect temporary="temporary" suburl="(.*)" dest="http://www.plopplopplop.com/\1"/>
21 }}}
22 Old syntax was (before Ocsigen 1.2):
23 {{{
24 <redirect regexp="(.*)" dest="http://my.newaddress.org/$1"/>
25 <redirect regexp="dir/(.*)\.html" dest="http://my.newaddress.org/$1.php"/>
26 <redirect regexp="http://(.*).myserver.org/(.*)" dest="http://$1.mynewserver.org/$2"/>
27 }}}