Tuckey URL Rewrite Filter with CF Wheels and ColdFusion 11
Asked Answered
S

0

6

I took over an application which was built in CF Wheels in ColdFusion 10 and was designed to run on Linux. It uses the Tuckey URL Rewrite filter to clean up the URLs. I'm trying to set it up on a Windows machine and use ColdFusion 11, but I'm having a problem with Tuckey URL Rewrite filter.

The problem is it cuts off the m in the cfm file extension, so ColdFusion throws a File Not Found error because of course there is no "rewrite.cf" file. I also noticed in the debugging output that the CGI.PATH_TRANSLATED variable ends with rewrite.cf, and the CGI.PATH_INFO ends with "m/[whatever directory path]" so somehow the filter is chopping up the file name it is supposed to be rewriting to. This only seems to happen when I use the "backreferences" in the "to" portion of the rewrite URL to pass the directory path to rewrite.cfm. If I just redirect to a plain cfm, without doing the backreferencing, it works fine. Other test rewrite rules also work ok and the rewrite-status looks good on my localhost. Anyone have any ideas?

Below is my rule from my urlrewrite.xml and a screenshot of the messed up PATH_TRANSLATED and PATH_INFO variables. Other than moving to Windows and CF 11, another difference is I'm running the application in a subdirectory of wwwroot ("portal"), but I have applied the filter and rules at wwwroot level and specified the directory in the rewrite rule.

<rule>
    <note>Apply CFWheels URL rewriting for portal.</note>
    <condition type="request-uri" operator="notequal">^/portal/$</condition>
    <condition type="request-uri" operator="notequal">^/portal/favicon.ico$</condition>
    <condition type="request-uri" operator="notequal">^/portal/cfide(.*)$</condition>
    <condition type="request-uri" operator="notequal">^/portal/images(.*)$</condition>
    <condition type="request-uri" operator="notequal">^/portal/javascripts(.*)$</condition>
    <condition type="request-uri" operator="notequal">^/portal/stylesheets(.*)$</condition>
    <condition type="request-uri" operator="notequal">^/portal/rewrite.cfm(.*)$</condition>
    <from>^/portal/(.*)$</from>
    <to type="passthrough" last="true">/portal/rewrite.cfm/$1</to>
</rule>

Tuckey Rewrite Problem

Spry answered 20/10, 2015 at 13:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.