Can clean URLs be achieved in a pure ColdFusion solution?

荒凉一梦 提交于 2019-12-10 21:52:09

问题


We need to estimate a portal based on ColdFusion technology. We have no information about the hosting environment (could be Windows or Linux).

One of the requested features is clean URLs. Does anyone know if this can be achieved with a pure ColdFusion solution or is this always web server related? I know there are neat extensions for IIS7 for enabling clean URLs but I'm afraid we can't depend on those.


回答1:


You can use ColdFusion's Application.cfc's onMissingTemplate() method to achieve this effect. If you want to have extensions other than .cfm you'll need to do some web server configuration to make ColdFusion serve other extensions and directory paths (e.g. /path/to/something/) needs to be configured to have a standard default document (e.g. index.cfm). Ben Nadel has a blog post that covers this idea extensively - be sure to check the comments as well.

That noted, both IIS 7 and Apache have URL rewriting modules (assuming these are the web servers in Windows and Linux, respectively). So this is a situation where if you know your URL patterns the module is an easier route. However, if the patterns are dynamic ColdFusion alone may be a better, if more complex path, where you'll need to configure the web server as I've explained above.




回答2:


Another option.

Check out "blogCFC" from Ray Camden (www.coldfusionjedi.com) ... it uses a pure CF approach to SES urls without the missing template approach.

The URLs look like /blabh.com/index.cfm/something/somethingelse

The .cfm in the middle is not pro-forma - but it works well and his blog software get's picked up on indexing engines pretty well. I use it.

Still another option is using the 404 handler on the web server.. this does require some configuration - but only in one spot and you don't have to write rules for a filter like mod_rewrite... but again, it may be beyond what you can accomplish if you have a restrictive hosting contract. Here's a post on the topic.

http://www.coldfusionmuse.com/index.cfm?mode=entry&entry=8F4658E4-0763-5FB7-67D23B839AB74005

-Mark



来源:https://stackoverflow.com/questions/4794221/can-clean-urls-be-achieved-in-a-pure-coldfusion-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!