1

我刚从 FW/1 开始,我只是想让事情正常进行,但对 SES url 没有太多运气。

所以在Application.cfc我打开 SES url 并删除index.cfm我有:

generateSES = true
SESOmitIndex = true

在我的main.cfc我有 2 件物品defaultseconditem

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' );
}

我有每个项目的视图,main.cfc我的web.config文件中有这个重写规则

<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>

那么问题来了:

当我去http://dev.dev/main/default- 它调用main.default

当我去http://dev.dev/main/seconditem- 它调用main.defaultmain.seconditem

如果我在index.cfm后面添加:

当我去http://dev.dev/index.cfm/main/default- 它调用main.default

当我去http://dev.dev/index.cfm/main/seconditem- 它调用main.seconditem

查看我的 IIS 日志,URL 被重写为包括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

因此,根据 IIS 日志告诉我重写工作正常,为什么当我转到没有它的 url 时index.cfm它总是转到main.default

我也尝试过使用不同的控制器:

http://dev.dev/users/default- 去main.default

但:

http://dev.dev/index.cfm/users/default- 去users.default

并且 IIS 日志显示了这两个请求:

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

任何想法都会非常感激

4

1 回答 1

3

这是我在 FW/1 项目中使用的重写规则

<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>

第二个<add>块用于列出我不想重写的目录或文件。

于 2014-02-20T14:11:26.367 回答