coldfusionroutescoldbox

how to check Coldbox route configuration is work?


I'm developing my own blog using Coldbox framework. Also I've added route configuration on my blog. I've created the URL route using addRoute() method given below.

addRoute(pattern="/login", handler="security.login", action="login");

But that isn't working also the url value goes to

www.myBlog.dev/login

And I was changed URL directly given below( Security is handler and login is action page)

www.myBlog.dev/index.cfm/security/login

that was working fine. Anyone give a solution to fix this.


Solution

  • The built-in Webserver of CF as well some J2EE webservers do not support natively URL rewrite. In this case CF works with the path information from the Request Headers and uses the part after filename.cfm/ - so in your case security/login gets resolved, but the route /login can not be resolved because the webserver does no route redirect.

    Since you are fortunately using Apache locally, you can activate the URL rewrite behavior by turning on mod_rewrite http://httpd.apache.org/docs/current/mod/mod_rewrite.html and get the same results as with a production webserver.