Reputation: 1
Hi I am wondering if there is a way to regenerate the URL when any page is loaded in coldbox/CF9 when using event.buildLink ?
Currently I get http://cawksd05.codandev.local:8080/entries/editor when using event.buildlink.
But the correct url should have /index.cfm added to it as shown below:
/index.cfm/entries/editor
Is there a way to set this once and where does this get set as I am confused where to set this for all my pages so that /index.cfm gets added the the url prefix when I do an event.Buildlink.
Thanks Faheem
// General Properties setUniqueURLS(false); setAutoReload(false);
// Base URL if( len(getSetting('AppMapping') ) lte 1){ setBaseURL("http://#cgi.HTTP_HOST#/index.cfm"); } else{ setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/index.cfm"); }
// Your Application Routes formatConstraints = {format="(xml|json)"};
addRoute(pattern="/api/:format/tasks/completed",handler="tasksAPI",action="list",constraints=formatConstraints,completed=true); addRoute(pattern="/api/:format/tasks",handler="tasksAPI",action="list",constraints=formatConstraints); addRoute(pattern="/api/:format?",handler="tasksAPI",action="invalid");
addRoute(pattern="/tasks/list/:status?",handler="tasks",action="index"); addRoute(pattern=":handler/:action?");
Upvotes: 0
Views: 816
Reputation: 354
No, setnextevent is the ONLY method in 3.0 that should be used, the other ones setnextRoute and relocate() are now deprecated.
If you made a change to the Route.cfm, make sure you reinitialize the application for the changes to take effect.
index.cfm?fwreinit=1
Usually they forget to reinit the app if a change is made.
Upvotes: 4
Reputation: 4577
Sounds like you need to set the baseURL in the /config/Routes.cfm file
// Base URL
if( len(getSetting('AppMapping') ) lte 1){
setBaseURL("http://#cgi.HTTP_HOST#/index.cfm");
}
else{
setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/index.cfm");
}
vs.
// Base URL
if( len(getSetting('AppMapping') ) lte 1){
setBaseURL("http://#cgi.HTTP_HOST#/");
}
else{
setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/");
}
Upvotes: 1