Question

I'm using Framework One (FW/1), Coldfusion 10 and trying to use Tuckey URLRewriteFilter to remove the index.cfm from the URL. I have generateSES set to true and SESOmitIndex to true in the FW/1 settings

I have the following code in my urlrewrite.xml file

<rule>
    <from>^/(.*)$</from>
    <to last="true">/index.cfm/$1</to>
</rule>

When I go view the application, I get a 404 error, so I dumped the CGI scope in my onMissingTemplate() method and I see the following keys that caught my eye.

PATH_INFO m/
PATH_TRANSLATED C:\Coldfusion10\cfusion\wwwroot\index.cf
CF_TEMPLATE_PATH  C:\Coldfusion10\cfusion\wwwroot\index.cf
SCRIPT_NAME //index.cf

It seems like it is butchering the Request/Context etc. I've seen some other posts here on SO, but without any answers.

I'm using ColdFusion 10 on my local Windows Vista machine with the local built in webserver.

Can anyone shed some light in what I'm doing wrong or why this is happening? I'm using the URLRewriteFilter version 4.0.3 http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html

Was it helpful?

Solution

> "I have generateSES set to true and SESOmitIndex to true in the FW/1 settings"

These two settings are irrelevant - they only affect the behaviour of the buildUrl method.
(Though maybe be useful to know that the presence of a path_info will toggle the "generateSES" flag on for that request, even if you explicitly disable it in the FW settings.)


If you're using a URL filter, you don't need to worry about going via path_info and it may be simpler to just rewrite to a query_string - again, both are used/processed regardless of the above settings.

As a first step, simply try this and see what you get:

<rule>
    <from>^/(?!index\.cfm|favicon\.ico|list|of|folders)(.*)</from>
    <to last="true">/index.cfm?action=$1</to>
</rule>

You'll probably notice the negative lookahead there (?!..) - it prevents actual files and directories from being incorrectly redirected - if you have any other root-level files add them in, along with any top-level folder(s) containing your images/stylesheets/etc, using | as a delimiter.

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