Reputation: 10121
We have the following rewrite rule on IIS7.5 (rewritten after answer by James Moberg):
<rule name="Anything else to the event handler" enabled="true" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{PATH_INFO}" pattern="^.*(/index.cfm/).*$" negate="true" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:1}" appendQueryString="true" logRewrittenUrl="true" />
</rule>
However, it never puts the /{R:1}
after it. It just goes to /index.cfm
. We need to actually get the reference variable, because we use this in our ColdFusion (10) scripts. An example url rewrite we would like:
From: http://www.my-site.com/this.is.a.test/another.test
To: http://www.my-site.com/index.cfm/this.is.a.test/another.test
Anyone who has an idea why it won't do this? (quick note: a ColdFusion error may occur when executing the correct URL, but I wouldn't think this would cause problems with rewriting?)
Note, it does actually work when you try the same in a browser (with the rule disabled) - just not with a rewrite rule. With the rewrite rule, cgi.PATH_INFO
variable in CF returns empty string.
Also, IIS does say it has rewritten the URL to index.cfm/this.is.a.test/another.test
in the logs, which is strange.
Upvotes: 1
Views: 1198
Reputation: 10121
The issue was that we needed to re-do the Configuration Tool of Coldfusion 10 after we applied the new update 11 yesterday. It's working now.
Upvotes: 0
Reputation: 4475
You should add conditions in case the website hosts images, js, css, etc. You also don't want to rewrite any possible URls that have CFM in them.
These are the conditions we're using:
<conditions>
<add input="{SCRIPT_FILENAME}" matchType="IsFile" negate="true" />
<add input="{SCRIPT_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{PATH_INFO}" pattern="^.*(/index.cfm/).*$" negate="true" />
</conditions>
Upvotes: 2