quick question -
Currently my urls look like this: index.cfm/camp/another-test
I would like for them to look like this: camp/another-test
I'm able to do this fine on apache with my .htaccess but I need to be able to do it on iis7 with the web.config. Here's my rewrite so far:
<rewrite>
<rules>
<rule name="Remove index.cfm" enabled="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" negate="true" pattern="^/(assets|files|miscellaneous|robots.txt|favicon.ico|sitemap.xml|index.cfm)($|/.*$)" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:1}" />
</rule>
</rules>
</rewrite>
Thanks for the help!
I believe CFWheels requires that you route rewrite requests through rewrite.cfm not index.cfm.
See the comment by Chris Peters on this question
If you adjust:
<rewrite>
<rules>
<rule name="Remove index.cfm" enabled="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" negate="true" pattern="^/(assets|files|miscellaneous|robots.txt|favicon.ico|sitemap.xml|index.cfm)($|/.*$)" />
</conditions>
<action type="Rewrite" url="/index.cfm/{R:1}" />
</rule>
</rules>
</rewrite>
to:
<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>
it should solve your problem, provided you have:
<cfset set(URLRewriting = "On")>
within /config/settings.cfm
Try adding this rewriting rule:
<rewrite>
<rules>
<rule name="ColdFusion on Wheels URL Rewriting" enabled="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{SCRIPT_NAME}" negate="true" pattern="^/(flex2gateway|jrunscripts|cfide|CFFileServlet|cfformgateway|railo-context|files|images|javascripts|miscellaneous|newsletters|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$)" />
</conditions>
<action type="Rewrite" url="/rewrite.cfm/{R:1}" />
</rule>
</rules>
</rewrite>