File: redirectmod.wiki

package info (click to toggle)
ocsigenserver 2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,484 kB
  • sloc: ml: 11,641; makefile: 707; sh: 619
file content (27 lines) | stat: -rw-r--r-- 1,259 bytes parent folder | download
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
=Redirectmod=

Redirectmod is a module allowing to define HTTP redirections from Ocsigen's configuration file. Submit your bugs and feature wishes (or any enhancement/mistake in the documentation) [[site:trac|here]].

To use that extension, first load it from the configuration file:
{{{
<extension findlib-package="ocsigenserver.ext.redirectmod"/>
}}}
Then configure your hosts as in these examples:
{{{
<redirect suburl="(.*)" dest="http://my.newaddress.org/\1"/>
<redirect suburl="dir/(.*)\.html" dest="http://my.newaddress.org/\1.php"/>
<redirect fullurl="http://(.*).myserver.org/(.*)" dest="http://\1.mynewserver.org/\2"/>
}}}
The syntax of regular expression is PCRE's one.
//Warning: the syntax recently changed from {{{$i}}} to {{{\i}}}.//

According to the RFC of the HTTP protocol, dest must be an absolute URL. By default, the redirection is permanent. For temporary redirection, use:
{{{
<redirect temporary="temporary" suburl="(.*)" dest="http://www.plopplopplop.com/\1"/>
}}}
Old syntax was (before Ocsigen 1.2):
{{{
<redirect regexp="(.*)" dest="http://my.newaddress.org/$1"/>
<redirect regexp="dir/(.*)\.html" dest="http://my.newaddress.org/$1.php"/>
<redirect regexp="http://(.*).myserver.org/(.*)" dest="http://$1.mynewserver.org/$2"/>
}}}