Link to home
Start Free TrialLog in
Avatar of brihol44

asked on

How can I force "index.cfm" into my link?


I've got an issue here that I'm not sure what happened. Recently the site was moved to another server and everything was working correctly but for some strange reason my linking in my blogcfc got messed up and I would like help in coding my fix in Coldfusion.

I have a bunch of emails that went out that need to have the correct link in them.

For example...

won't work now... It worked before but again not sure what happened. I would like somebody to help me figure out as a quick fix. So...

will work I just need help with the code to include the "index.cfm" if it's not defined in the URL. The BlogCFC uses a application.cfc so I assume I would post the code there.

Thank you for the help.


Avatar of Hammo777

Make the default file in (whatever the default file is for the server, index.cfm, defaut.cfm) cflocation to
Check the default file order. Every hosting has options for this
Avatar of gdemaria

From the one example, it seems that the problem is that you need to remove "index.cfm" from the erroneous path.   If that is true then you could do this...

Inside your index.cfm file which is located here  (if it doesn't exist, then created it)
you can get the URL string, change it and then redirect to the correct page.


<cfset theURL = cgi.path_info>

<cfset theURL = replaceNOcase(theURL,'index.cfm/','')>

<cflocation url="#theURL#" addToken="no">

Avatar of SidFishes
Flag of Canada image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial