How can I convert these IIS rewrite rules to Nginx Rewrite Rules?

Viewed 60

How can I convert these IIS rewrite rules to nginx rewrite rules? I tried a converter, but it doesn't really seem to work and I'm not really familiar with Nginx. I used this: https://github.com/ismai1/iis-to-nginx

<rule name="Changes URL" stopProcessing="false">
    <match url="^changes/([^/]+)/([^/]+)/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="changes?year={R:1}&amp;month={R:2}" />
</rule>
<rule name="CMS URL" stopProcessing="false">
    <match url="^content/view/([^/]+)/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="content/view?id={R:1}" />
</rule>
<rule name="CMS Page URL" stopProcessing="false">
    <match url="^content/view/([^/]+)/([^/]+)/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="content/view?id={R:1}&amp;cpage={R:2}" />
</rule>
<rule name="CMS Permissions URL" stopProcessing="false">
    <match url="^content/permissions/([^/]+)/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="content/permissions?id={R:1}" />
</rule>
<rule name="MainPages" stopProcessing="false">
    <match url="^([^/]+)/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php?page={R:1}" />
</rule>
<rule name="SubPages" stopProcessing="false">
    <match url="^([^/]+)/([^/]+)/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php?page={R:1}&amp;spage={R:2}" />
</rule>
<rule name="Map Image Redirect 2" stopProcessing="true">
    <match url="^ingame/getmap_image/([^/]+).jpg/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="ingame/getmap_image.php?map={R:1}" />
</rule>
<rule name="Map Image Redirect" stopProcessing="true">
    <match url="^ingame/getmap_image/large/([^/]+).jpg/?$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="ingame/getmap_image.php?map={R:1}&amp;large=1" />
</rule>
0 Answers
Related