Is it possible to rewrite url using ColdFusion?

前端 未结 3 1692
礼貌的吻别
礼貌的吻别 2021-01-03 08:59

I have got a requirement for generating user friendly urls.I am on IIS.

My dynamic URLs looks like,

www.testsite.com/blog/article.cfm?articleid=4432

3条回答
  •  爱一瞬间的悲伤
    2021-01-03 09:44

    To add to what cfqueryparam suggested, this post on Using ColdFusion to Handle 404 errors shows how to replace the web server's 404 handler with a CFM script - giving you full rewrite capabilities. It is for an older version of IIS, but you should be able to find the proper settings in the IIS version you are using.

    As Adam and other's have said (and the same point is made in the post) this is not something you should do if you can avoid it. Web servers working at the HTTP level are much better equipped to do this efficiently. When you rely on CF to do it you are intentionally catching errors that are thrown in order to get the behavior you want. That's expensive and unnecessary. Typically the issue with most clients or stakeholders is a simple lack of understanding or familiarity with technology like url rewriting. See if you can bend them a little. Good luck! :)

提交回复
热议问题