ColdCourse Updated for Nicer URLs Regardless of Hosting

One of the biggest limiting factors of ColdCourse was that in order to get the full effect you needed to have a host that supported .htaccess files or have access to install an isapi filter on IIS. Not anymore though! Now you can create SES URLs regardless of your OS or host as long as you don’t mind BlogCFC style rewrites that look like /index.cfm/some/parameters. Here’s a rundown of how ColdCourse works:

You enter the URL into your browser such as http://localhost/mycontroller/myaction or http://localhost/index.cfm/mycontroller/myaction. ColdCourse takes over before your framework (fusebox, model-glue, mach-ii, coldbox or just about anything else) and tells your framework that the page that was really called was http://localhost/index.cfm?fuseaction=mycontroller.myaction. This is how ColdCourse had been all along when using .htaccess/isapi filters, but now you can call the http://localhost/index.cfm/mycontroller/myaction URL without any webserver setup.

All the same bells and whistles from before are still in there:

  • Hooks into all major frameworks that use a single event/fuseaction variable with a single value.
  • Ability to have unique URLs, so that http://localhost/index.cfm?fuseaction=mycontroller.myaction forwards the user to http://localhost/mycontroller/myaction for example.
  • Ability to create new URL parameters programmatically rather than by editing a .htaccess file. For instance You might want http://localhost/user/AdamFortuna to be the same as http://localhost/index.cfm?fuseaction=user.about&username=AdamFortuna.
  • Ability to have specifically named actions included automatically. For instance the URL http://localhost/home might be the same as http://localhost/home/index, or http://localhost/index.cfm?fuseaction=home.index. ColdCourse can make sure when someone types http://localhost/home/index it’ll redirect them to http://localhost/home
  • All redirects are done using the “301 Moved Permanently” implementation which means search engines will pick up the new URLs with ease and not index multiple resources with the same content.
  • You can drop it into an already existing application and see how it works! If you’ve been linking to resources with a prefix slash then ColdCourse will work right out.

Coldcourse is honestly a snap to use. There’s one setup file when you can basically forget about it until you have to create a custom course. If you’re in the market for SES URLs, give it a try!


 
 
 

9 Responses to “ColdCourse Updated for Nicer URLs Regardless of Hosting”

  1. Oh why oh why can’t there be a solid CF host that’s on par spec and price-wise with Dreamhost or Media Temple? That way, I could use ColdCourse or similar in production.

  2. I’ve got a problem on a MG:U app?

    Development setup IIS/2003:
    localhost/appName/index.cfm

    Error:
    Model-Glue: There is no known event handler for “appName.index.cfm”

    Ideas?

  3. Nevermind simply changed page.index to appname.index.cfm in ModelGlue.xml config file. It seems to work great! Sorry to take space in the blog.

  4. Hmm, I hadn’t tested it on applications that weren’t in the base directory actually. That’s pretty cool that it works! I’ll give a few tries here over the weekend and see if I can’t include information about that in the readme.

  5. Just spent a couple of days trying to get the rewrite rules to work, tried to be clever and put them directly in the VirtualHost directive which doesn’t work. Eventually tried AllowOveride All and just used the a .htaccess file and all works straight away!

    I’m not sure why .htaccess works but the same rules in the httpd.conf won’t but i thought it was worth a mention incase anyone else ran into this problem.

  6. I am getting a Model-Glue: There is no known event handler for “index.cfm.” error in an existing mg:u application.

    http://localhost/index.cfm is the “home” URL

    setUniqueURLs = false
    setBaseURL(“http://localhost/index.cfm”)

    in my onrequeststart function in my controller I am setting myself value = “”

    I don’t understand how/why index.cfm is an “event handler” as the “home” event handler is home which then does page.index. I have tried to change the value and add an event handler called index.cfm but I can’t seem to get Coldcourse to work. Do you have any suggestions as there is not a lot of MG:U examples with Coldcourse.

    Thanks

    Thanks

  7. @Robb
    What server are you running it on? If you’re trying to routes in the
    http://localhost/index.cfm/home/main
    form, then you’ll need to remove all other routing with .htaccess/isapi filters, as that’s using base ColdFusion for the routing.

    If you’re using those and have index.cfm in the BaseURL i think it will fail though, because apache/iis will convert htp://localhost/index.cfm into http://localhost/?event=index.cfm if I’m not mistaken, which will mess things up before it gets to coldcourse.

    Shouldn’t worry about the onrequest start or anything within MG though. By the time it gets to MG all ColdCourse processing is done and the event should be set as a URL variable. I’d try making a onrequeststart function and dumping the URL scope to see what coldcourse is setting, then tweaking the CC settings to make it what you need.

    I have a few things planned for CC including some more examples and documentation, but think that’ll be at least two weeks away at this point. I’ll make sure to add a MG example to the list though.

  8. Adam,

    I am running on IIs. Dumping the URL scope gives me:

    EVENT index.cfm.

  9. Installed IIRF (Ionics rewriter) using your included isapi.ini file and everything works great! Just a note to other MG:U users, event handlers must be consistent as stated in the readme file; “page.index” works but the next event handler can not be “about”, it MUST be “page.about” referenced in the URL as http://localhost/page/about.

    Thanks Adam for a great tool!