Tweaks of PyXWF behaviour

PyXWF.Tweaks.Host — Host based behaviour

Namespace: http://pyxwf.zombofant.net/xmlns/tweaks/host, prefix: host:

  • tweak node <host:redirect />

    Occurrence: zero or more

    Attributes:

    @src:host name — Host name to redirect from
    @dest:host name — Host name to redirect to
    @method:redirect method — Method of redirect, see Valid values for *redirect methods*. internal is not allowed

    Allowed child nodes: None

If the current request is issued with the HTTP Host header equal to a host given in one of the redirect nodes @src attributes, an HTTP status code according to @method is set and the Location header is set to the same absolute URI as the current location, except that the host name is set to the value of the respective @dest attribute.

  • tweak node <host:force-mobile />

    Occurence: zero or more

    Attributes:

    @host:host name — Host name to match against
    @mobile:boolean — The value to set the IsMobileClient property to

    Allowed child nodes: None

If the current request is issued with the HTTP Host header equal to a host given in one of the force-mobile nodes @host attributes, the value of the IsMobileClient property is set to the value of the respective @mobile attribute.

This is useful to create mobile versions of websites, based on the host name rather than the user agent. For this to override the User-Agent based detection completely, you need a <host:force-mobile /> node for each host name the PyXWF site handles requests for.

Table Of Contents

Previous topic

Advanced plugins

Next topic

PyWeblog, a blogging engine

This Page