Post

Jexus Series: URL Rewrite

This post talks about Jexus URL Rewrite.

Jexus does not support outbound rules (unlike IIS URL Rewrite module), but it supports simple inbound rules.

For more information on Jexus/IIS comparison you can go to https://github.com/jexuswebserver/jexus-contrib/blob/master/comparison.en.md

To configure IIS URL Rewrite, you might follow this article.

Assume that we have the following rule defined on IIS,

1
2
3
4
5
6
7
8
<rewrite>
    <rules>
        <rule name="Rewrite to article.aspx">
            <match url="^article/([0–9]+)/([_0–9a-z-]+)" />
            <action type="Rewrite" url="article.aspx?id={R:1}&amp;title={R:2}" />
        </rule>
    </rules>
</rewrite>

The rule can be translated to Jexus style as

1
rewrite=^/article/([0–9]+)/([_0–9a-z-]+) /article.aspx?id=$1&amp;title=$2

Compared to IIS, Jexus inbound rule contains less features right now. Below are the things it does not yet support,

  • Actions such as Redirect or AbortRequest
  • Conditions
  • Ability to break from cascading rules
© Lex Li. All rights reserved. The code included is licensed under CC BY 4.0 unless otherwise noted.
Advertisement

© - Lex Li. All rights reserved.

Using the Chirpy theme for Jekyll.

Last updated on November 06, 2024