Routes configuration for subdomains to modules

Hi,

Apologies in advance if this questions has been asked, I couldn’t find it though in my searches.

I’m trying to set up my routes file so that subdomains for my URL point to custom modules in my modules_app folder. For example:

http://mysite.com/admin becomes http://admin.mysite.com

And handlers/actions are presented without the name of the module in the URL like:

http://mysite.com/dashboard/settings/edit becomes http://dashboard.mysite.com/settings/edit

Does anybody have some example code on how to achieve this?

Thanks in advance…

Forgot to add the version in the subject! sorry!

Jonah,

The easiest way to do this by customizing the PathInfoProvider( event ) method in your config/Routes.cfm.

Then you can detect the inbound subdomain and prepend the module assignment to the route string.

Example:

function PathInfoProvider(Event){

var pathArray = listToArray( CGI.PATH_INFO, “/” );

switch( CGI.SERVER_NAME ){

case “my.sub.domain.com”:{

arrayPrepend( pathArray, “myModuleEntryPoint” );

break;

}

}

return arrayToList( pathArray, “/” );

}

HTH,

Jon