Coldfusion 10 File Not Found Error

假装没事ソ 提交于 2019-12-13 02:58:21

问题


When I try to access a page that is not found, Coldfusion 10 provides this error page instead of redirecting to our 404 Page Not Found page. How can I get Coldfusion to redirect to our Page Not Found page instead of providing this error message?


回答1:


At he point at which the error is thrown the web server is not actually in control of the request. It is waiting for CF to "hand back" the request as string buffer - content to serve.

That means there is an additional step in CF to handle missing templates. You can set (as Adam has said) the missing template handler in the CF admin - or if you are using an Application.cfc you can use the function onMissingTemplate() to do whatever you think is appropriate for a missing cfm page.




回答2:


Since the request was made for a .cfm page Coldfusion is expected to handle the request, since the file is not found then Coldfusion triggers the standard 404 error. You can do 1 of 2 things:

  1. Set up a 404 template on the Coldfusion administrator, as Mark A Kruger suggested.
  2. Set up the Application.cfc to handle the request by using the onMissingTemplate() function. Here is more documentation on that: http://bit.ly/17k4Ry8

NOTE: You can set up your onMissingTemplate() function to redirect to the actual 404 template, since it sounds like you already have one. This would be considered a Soft 404 to the crawlers.

Good Luck!

Thanks -Al



来源:https://stackoverflow.com/questions/18470520/coldfusion-10-file-not-found-error

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