I am trying to use the wildcard match on routes in FW/1 v 3.5.
Application.cfc
component extends="framework.one" {
this.name= "Wildcard7";
variables.framework = {
home = 'main.home',
action = 'fuseaction',
baseURL = 'useCgiScriptName',
trace = isDebugMode()
};
variables.framework.routes = [
{ "main/home" = "main/home"},
{ "*" = "main/404"}
];
}
When I run the page, without specifying an action, I get the main/404 page instead of main/home
** FW/1 trace**
How can I get main/404 to run only on invalid pages?
When I run the page, without specifying an action, I get the main/404 page instead of main/home
I assume you are trying to access the page like so - your.domain/index.cfm/main
. Note the lack of the home
action.
Based on your routes, your first route is saying if the path supplied equals "main/home" then point to the view main/home
. If there is an action of home
in a main.cfc
controller then that will be ran prior to rendering the view.
Leaving off the action, home
, would not match any of your current routes; resulting in your wildcard catching it. You would need to handle it by including another route like {"main" = "main"}
.
UPDATE:
To access main/home
from your.domain/index.cfm
, you can try passing a route of {"/" = "main/home"}
. I would suggest this being above your wildcard and below any other routes to avoid any freak matches.