Skip to content

URL Rewrite Rule Examples

Adam Tuttle edited this page Jun 10, 2011 · 21 revisions

This page gives example URL Rewriting rules for the most common Rewriting engines. All examples assume that your API exists at: http://example.com/api/index.cfm, and the resulting URL should resemble: http://example.com/api/artists (where "/artists" is the resource being requested)

Apache mod_rewrite

See the official documentation for more information.

    RewriteRule ^/api/(.*) http://example.com/api/index.cfm/$1

IIRF (Ionic's ISAPI Rewrite Filter)

See the official documentation for more information.

    RewriteRule ^/api/(.*)$ /api/index.cfm/$1

ISAPI Rewrite (Helicon)

See the official documentation for more information.

    ?

IIS7 web.config

See the official documentation for more information.

^--- fix docs url

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule>
                    <match url="^api/(.*)$" />
                    <action type="Rewrite" url="index.cfm/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Clone this wiki locally