SES and no index.cfm struggles

103 views
Skip to first unread message

West

unread,
Jan 29, 2011, 2:05:32 AM1/29/11
to ColdBox Platform
Hi,

I'm on CF 9 and IIS 7.

I've got SES working halfway the way I'd like it to work but I'd like
my URLS to not have the index.cfm in them. Currently, this URL works,
but you can see the index.cfm in it.

http://www.abc.com/index.cfm/store/product

I'm trying to not include the index.cfm part so I removed it from my
"Routes.cfm" file so it looks like this now but when I go to the new
url: http://www.abc.com/store/product, the page doesn't change, I just
see my home page, it's as if it's just getting ignored:

<cfscript>
setEnabled(true);
setUniqueURLS(true);
if( len(getSetting('AppMapping') ) lte 1){
setBaseURL("http://#cgi.HTTP_HOST#/");
}
else{
setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/");
}

addRoute(pattern=":handler/:action?");
</cfscript>

Thanks

Luis Majano

unread,
Jan 29, 2011, 12:42:06 PM1/29/11
to col...@googlegroups.com
Because you need to activate a URL rewriter at the web server level.  You cannot do this out of the box like that.  You need to activate rewriting in your case via IIS7.

-- 
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

Malik Robinson

unread,
Jan 29, 2011, 1:11:19 PM1/29/11
to col...@googlegroups.com
Hi,

Thanks for the response Luis.

I used the web.config file that is here:

http://blog.coldbox.org/post.cfm/coldbox-and-url-rewrites-with-iis-7

I just copied the code here into a web.config file which lives in the root of my site.  When I open up IIS, I can see all the rules.  I basically downloaded the IIS 7 rewrite module.

Does something need to be modified in this file?

adk

unread,
Jan 29, 2011, 1:37:38 PM1/29/11
to ColdBox Platform
all you need is this to do what you want to do:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="remove index.cfm" stopProcessing="true">
<match url="^(.*)$" />
<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/{URL}"
appendQueryString="true" logRewrittenUrl="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

On Jan 29, 10:11 am, Malik Robinson <malik.robin...@gmail.com> wrote:
> Hi,
>
> Thanks for the response Luis.
>
> I used the web.config file that is here:
>
> http://blog.coldbox.org/post.cfm/coldbox-and-url-rewrites-with-iis-7
>
> I just copied the code here into a web.config file which lives in the root
> of my site.  When I open up IIS, I can see all the rules.  I basically
> downloaded the IIS 7 rewrite module.
>
> Does something need to be modified in this file?
>
> > For Documentation, visithttp://wiki.coldbox.org

adk

unread,
Jan 29, 2011, 1:37:45 PM1/29/11
to ColdBox Platform
all you need is this to do what you want to do:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="remove index.cfm" stopProcessing="true">
<match url="^(.*)$" />
<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/{URL}"
appendQueryString="true" logRewrittenUrl="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

On Jan 29, 10:11 am, Malik Robinson <malik.robin...@gmail.com> wrote:
> Hi,
>
> Thanks for the response Luis.
>
> I used the web.config file that is here:
>
> http://blog.coldbox.org/post.cfm/coldbox-and-url-rewrites-with-iis-7
>
> I just copied the code here into a web.config file which lives in the root
> of my site.  When I open up IIS, I can see all the rules.  I basically
> downloaded the IIS 7 rewrite module.
>
> Does something need to be modified in this file?
>
> > For News, visithttp://blog.coldbox.org
> > For Documentation, visithttp://wiki.coldbox.org
>
> >   --
> > You received this message because you are subscribed to the Google Groups
> > "ColdBox Platform" group.
> > To post to this group, send email to col...@googlegroups.com
> > To unsubscribe from this group, send email to
> > coldbox-u...@googlegroups.com
> > For more options, visit this group at
> >http://groups-beta.google.com/group/coldbox

West

unread,
Jan 29, 2011, 2:29:49 PM1/29/11
to ColdBox Platform
Thanks for the replies but the same issue still happens. When I click
a link the URL changes and it looks right, but the page itself doesn't
change. The URL looks right but the page doesn't load. I turned on
coldbox debugging and I think I can see the problem, I just don't know
how to fix it.

In the coldbox debugger, under "Coldbox Request Structures" I can see
that the event is NOT changing, so even though the URL is changing in
the browser, the actual value of the event variable is not changing.

Is there something else I need to do, maybe in the Routes.cfm file?

adk

unread,
Feb 1, 2011, 8:00:30 PM2/1/11
to ColdBox Platform
Hmmm... my advice would be to set up a new quick and dirty 1-page pure
HTML website in IIS with a simple test re-write rule and see if that
works first (basically de-couple from Coldbox and even CF) That way
you can tell if the issue lies with your IIS/Re-Write install or iod
CF/CB related.

I needed to do this just a few weeks ago: I could not for the life of
me figure out what was causing a lot of odd issues with my Coldbox
app. Eventually I narrowed it down to rewrites and specifically with
a bug in Helicon Tech's ISAPI ReWrite using the above technique. That
caused me to install the new rewrite engine 2.0 for IIS 7 and
basically I never went back to Helicon Tech. (By the way, I had used
their product and loved it for years and Helicon Tech forum moderators
believe they eventually figured out the bug, but by then I was happy
with the IIS app so I never reinstalled it.)

Malik Robinson

unread,
Feb 1, 2011, 8:33:38 PM2/1/11
to col...@googlegroups.com
Makes sense.  I looked at the ColdBox examples and the only example for SES contains index.cfm in the URL.  This works fine for me, but my goal is to have it work without the index.cfm in the URL.

Did you have to make any special changes to your "Routes.cfm" file or and above what I posted in my first message?

I too am using the new rewrite engine 2.0 for IIS 7.  I will keep trying and post back if I can find the solution.  

Thanks for responding back...

adk

unread,
Feb 1, 2011, 10:13:42 PM2/1/11
to ColdBox Platform
My routes has this:

// Base URL
if( len(getSetting('AppMapping') ) lte 1){
setBaseURL("http://#cgi.HTTP_HOST#/");
}
else{
setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/");
}

and my web.config is posted above. That's it, nothing more?

On Feb 1, 5:33 pm, Malik Robinson <malik.robin...@gmail.com> wrote:
> Makes sense.  I looked at the ColdBox examples and the only example for SES
> contains index.cfm in the URL.  This works fine for me, but my goal is to
> have it work *without *the index.cfm in the URL.
>
> Did you have to make any special changes to your "Routes.cfm" file or and
> above what I posted in my first message?
>
> I too am using the new rewrite engine 2.0 for IIS 7.  I will keep trying and
> post back if I can find the solution.
>
> Thanks for responding back...
>
> On Tue, Feb 1, 2011 at 5:00 PM, adk
> <andrew+cold...@leftbower.com<andrew%2Bcold...@leftbower.com>
> > > On Jan 29, 10:37 am, adk <andrew+cold...@leftbower.com<andrew%2Bcold...@leftbower.com>>

Malik Robinson

unread,
Feb 1, 2011, 10:31:03 PM2/1/11
to col...@googlegroups.com
Yep, same here.  I will try again.  There must be something not right on my side.  Stay tuned...

Thanks again!

Jason Durham

unread,
Feb 1, 2011, 10:45:18 PM2/1/11
to col...@googlegroups.com
If this hasn't been said before you'll also need a <base> tag for your assets. 

Sent from my iPhone

Malik Robinson

unread,
Feb 2, 2011, 2:03:53 AM2/2/11
to col...@googlegroups.com
Yes, I have the base tag, but thanks.  I found out I needed it right when my css and js includes weren't working...and I think it's mentioned in the forums here as well.
Reply all
Reply to author
Forward
0 new messages