How to enable URL rewriting in cfwheels 1.4 on iis 7.5?

213 views Asked by At

I use cfwheels 1.4 on Railo 4.2.2.004 on windows server 2008R2 with IIS 7.5 and can't get URL rewriting to work.

In config/settings.cfm I have

set(URLRewriting="On");

My web.config looks like this

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                        <rule name="ColdFusion on Wheels URL Rewriting" enabled="true">
                            <match url="^(.*)$" ignoreCase="true" />
                            <conditions logicalGrouping="MatchAll">
                                <add input="{SCRIPT_NAME}" matchType="Pattern" ignoreCase="true" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|CFFileServlet|cfformgateway|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$)" />
                            </conditions>
                            <action type="Rewrite" url="/rewrite.cfm/{R:1}" />
                        </rule>
                </rules>
            </rewrite>
        </system.webServer>
</configuration>

I installed the URL rewrite module in IIS. IIS does show the inbound rules out of the web.config file.

The browser shows an

Error: Redirection error

I basically followed: [Removing index.cfm from url with web config

What am I missing? Regards Thorsten

1

There are 1 answers

0
Thorsten On BEST ANSWER

FYI I solved the problem by replacing redirectTo() with the plugin internalredirect. ;-)

public void function setControllerAndView() {                   

        /*redirectTo(    controller="#request.domaininfo.getHomeController()#",
                    action="#request.domaininfo.getHomeAction()#");*/

        // use plugin internalredirect.cfc
        internalredirect(    controller="#request.domaininfo.getHomeController()#",
                            action="#request.domaininfo.getHomeAction()#");       
    }