问题描述
我们需要估计基于ColdFusion技术的门户。我们没有有关托管环境的信息(可以是Windows或Linux)。
We need to estimate a portal based on ColdFusion technology. We have no information about the hosting environment (could be Windows or Linux).
所请求的功能之一是干净的URL。有谁知道这是否可以通过纯ColdFusion解决方案实现,或者这始终与Web服务器相关?我知道IIS7有一些整洁的扩展程序,用于启用干净的URL,但恐怕我们不能依赖这些扩展程序。
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.
推荐答案
您可以使用ColdFusion的 Application.cfc
的 onMissingTemplate()
方法来实现此效果。如果要使用.cfm以外的扩展名,则需要进行一些Web服务器配置,以使ColdFusion服务其他扩展名和目录路径(例如 / path / to / something /
)需要配置为具有标准的默认文档(例如 index.cfm
)。 -请务必同时检查评论。
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.
注意,这两个和具有URL重写模块(假设这些是Windows中的Web服务器和Linux)。因此,在这种情况下,如果您知道您的URL模式,则该模块是一条更简单的路线。但是,如果模式是动态的,那么单独使用ColdFusion可能是更好的选择,如果路径更复杂,则如上所述,您需要在其中配置Web服务器。
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.
这篇关于可以在纯ColdFusion解决方案中实现干净的URL吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!