views:

131

answers:

4

The host that I want to host with does not support server side url rewriting, thus no third party tools can be installed to rewrite the url's.

This is Coldfusion 8, on windows, IIS.

The other alternative that I know of is to use a framework, but I do not feel like taking that route (time), for the application works well as it is (but the URL).

Can clean urls be generated by purely CF? I do not need the clean url's for seo, rather it will be for the user's easy reference to their page. E.g. youtube.com/userpage

Any sugessions?

If the only choice is to use a framework, then which one is most compatible with traditional cfml'', cfm's & CFC's? In that there needs to be minimum changes to the code in the conversion from the none frameworked app to become frameworked.

Thanks for you contributions!

+3  A: 

You can use the Framework/1 framework or CFWheels to achieve clean URL's but it will need to include the "/index.cfm/" at the beginning of the URL in order to trigger ColdFusion's application handler code.

EDIT: Please see Aaron Greenlee's work around to prevent the "index.cfm" from appearing in the URL.

i.e. Whichever approach you take, if you cannot add a 3rd party tool to rewrite URLs (and not using Apache), your URL's will be in the form of http://site.com/index.cfm/section/item

eg. http://site.com/index.cfm/user/login http://site.cfm/index.cfm/user/signup

FW/1 offers the option of passing in URL variables in a search engine friendly format as well.

Examples:

http://site.com/index.cfm/user/login/email/[email protected]/password/test is the same as http://site.com/index.cfm/user/[email protected]&password=test is the same as http://site.com/index.cfm?action=user.login&[email protected]&password=test

eapen
Thanks for tho info. I did not know that frameworks needed 3rd party tools to render clean url's.
Nich
Any alternative hosts out there that are secure, got good support and are reputable that can supply what I need?
Nich
Just to clarify, CF won't intercept requests to a JPG file, GIF file if you are using IIS. CF only intercepts the .cfm or .cfc file extensions and therefore, if you use a 3rd party tool, you can write rules that ask CF to handle it (by asking it to add a /index.cfm/ at the beginning). But the frameworks can generate URL's without the /index.cfm and in a friendly format http://site.com/user/login (hope that makes sense).Not too sure about alternative hosts - HostMySite (pricey) or Alurium (which uses Railo and probably Apache which gives you the ability to add a .htaccess file with rules)
eapen
@Nich where did you get the impression that frameworks need 3rd party tools to do what @eapen suggests?
Antony
@Antony Got it from the first two paragraphs of the answer. The answer says that if you cant install the tools, index.cfm will be in the URL. Eapen corrected it in the comment.
Nich
@nich - fw/1 is a single file (cfc) framework, no installation required apart from a mapping in some cases
Antony
+1  A: 

Go ahead and learn a framework. Most will work for this. However if you just do not want to learn a framework.

www.mysite.com/products/ will run: www.mysite.com/products/index.cfm

www.mysite.com/products/books will run: www.mysite.com/products/books/index.cfm

Framework/1 and CFZen will work for this a they are very simple 1 file frameworks that you can just work around.

CFZen http://cfzen.riaforge.org http://cftipsplus.com/blog/?tag=cfzen

Framework/1 http://fw1.riaforge.org http://corfield.org - the author of Framework/1

Nathan Stanford
+3  A: 

No. you do not need a framework or URL rewriter to get http://domain.com/some/url to work (notice no index.cfm).

In IIS you can set up custom error pages for 404 errors. Make the custom error page execute a ColdFusion page on your server (/urlhandler.cfm, 404.cfm or index.cfm for example). Within that page, you can control your own routes with ColdFusion by using list methods on the cgi.query_string value. IIS will provide you a url that looks something like 404;http://domain.com/the/original/url which you can parse to route the visitor to your desired event.

<!--- Get URL String --->
<cfset CurrentURL = ListGetAt(cgi.query_string, 2, ";")>
<cfset CurrentURL = Replace(CurrentURL, ":80", "")>
<cfset CurrentURL = Replace(CurrentURL, ":443", "")>
<cfset CurrentURL = Replace(CurrentURL, "403;", "")>
<cfset CurrentURL = Replace(CurrentURL, "'", "", "ALL")>

We have a site that receives approx a million visitors a month that is still running SES urls with this method. I was shocked when I was hired and found this existing code at the heart of the site and would not elect to repeat it, but, if you have limitations on installing a rewriter or third party framework (this client placed restrictions on the site) this solution may work for you.

By playing with the above code, you can quickly see how you may use CF to dynamically include the .CFM file you want or execute the right CFC code depending on your set up.

Aaron Greenlee
I should note, you can also use http://coldcourse.riaforge.org/ to handle the parsing of your routes. This is the same project that inspired the ColdBox SES Routing system.
Aaron Greenlee
Interesting approach Aaron, didn't think of using this option - it doesn't send back a response header code of 404, does it?Also, this requires Nich to have the ability to customize the 404 error page (which should be available with most hosts).
eapen
No, it is invisible to the client. Given the choice, I would opt for ColdBox and Apache or IIS with Microsoft's rewriter. But, I think this is a solid answer to his question.
Aaron Greenlee
A: 

Instead of using http://yoursite.com/index.cfm/user, you can do http://yoursite.com/user.cfm and catch the error in the OnMissingTemplate function of application.cfc. This will not require you to set a custom 404 page.

Yisroel