Link to home
Start Free TrialLog in
Avatar of brihol44
brihol44

asked on

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

Hello,

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...

http://www.sitename.com/myblogs/2010/12/30/postName

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...

http://www.sitename.com/myblogs/index.cfm/2010/12/30/postName

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.

Brian

Avatar of Hammo777
Hammo777

Make the default file in http://www.sitename.com/myblogs/index.cfm/2010/12/30/postName (whatever the default file is for the server, index.cfm, defaut.cfm) cflocation to
http://www.sitename.com/myblogs/index.cfm/2010/12/30/postName.
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
   http://www.sitename.com/myblogs/index.cfm  (if it doesn't exist, then created it)
you can get the URL string, change it and then redirect to the correct page.


index.cfm

<cfset theURL = cgi.path_info>

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

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


ASKER CERTIFIED SOLUTION
Avatar of SidFishes
SidFishes
Flag of Canada image

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