Question

I've just started with FW/1 and I'm just trying to get things working but not having much luck with the SES urls.

So in Application.cfc I'm turning SES urls on and removing index.cfm I have:

generateSES = true
SESOmitIndex = true

in my main.cfc I have 2 items default and seconditem:

public void function default( rc ) {
    rc.when = now();
    variables.fw.service( 'formatter.longdate', 'today' );
}

public void function seconditem( rc ) {
    rc.when = now();
    variables.fw.service( 'formatter.longdate', 'today' );
}

I have the views for each item in main.cfc and I have this rewrite rule in my web.config file

<rule name="Insert index.cfm" stopProcessing="true">
    <match url="^(.*)$" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.cfm/{PATH_INFO}" appendQueryString="true" logRewrittenUrl="true" />
</rule>

So here's the issue:

When I go to http://dev.dev/main/default - It calls main.default

When I go to http://dev.dev/main/seconditem - It calls main.default not main.seconditem

If I add the index.cfm back in:

When I go to http://dev.dev/index.cfm/main/default - It calls main.default

When I go to http://dev.dev/index.cfm/main/seconditem - It calls main.seconditem

Looking at my IIS logs the URL is getting rewritten to include index.cfm:

2014-02-19 23:13:44 GET /index.cfm/main/default - 80
2014-02-19 23:13:53 GET /index.cfm/main/seconditem - 80

So based on the IIS logs telling me the rewrite is working, why when I go to the url without the index.cfm it always goes to main.default?

I've also tried with different controllers where:

http://dev.dev/users/default - goes to main.default

but:

http://dev.dev/index.cfm/users/default - goes to users.default

And the IIS logs show this for both requests:

2014-02-19 23:20:47 GET /index.cfm/users - 80
2014-02-19 23:21:37 GET /index.cfm/users - 80

Any ideas would be really appreciated

Was it helpful?

Solution

Here is a rewrite rule I use on a FW/1 project

<rule name="Imported Rule 1" stopProcessing="true">
        <match url="^(.*)$" />
        <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" pattern="^((?!\.).)*$|(\.cfm)$" />
            <add input="{URL}" matchType="Pattern" pattern="/(assets|scratch|remote|index.cfm|extensions)" ignoreCase="true" negate="true" />
        </conditions>
        <action type="Rewrite" url="/index.cfm/{R:1}" />
</rule>

The second <add> block is used to list directories or files I do not want rewritten.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top