What are SES URLs?
In a nutshell, an SES URL has all &, ?, and = characters replaced with /.For example:
www.example.com/index.cfm?foo=1&bar=2
can be written as:
www.example.com/index.cfm/foo/1/bar/2/
You can also use a "dummy file:"
www.example.com/index.cfm/foo/1/bar/2.cfm
or get more detailed with dummy directories and files:
www.example.com/index.cfm/foo/1/bar/2/the_page/about_us/day/monday.cfm
How do you use sesConverter?
There are two important things to be aware of:- how to execute this script
- basehref tag
This CF script can be CFINCLUDED or called as a custom tag. Here's some code to use for CFINCLUDING:
<!--- ses stuff ---> <cfset SESdummyExtension = ".cfm"> <cfset SESrBaseName = "baseHREF"> <cfinclude template="sesConverter.cfm">Where to you put this code? Well, it depends:
If you are using Fusebox:
- Fusebox v3 or 4 - index.cfm, before core file(s)
- Fusebox v1 or 2 - app_globals.cfm
2) BASEHREF Tag:
SES URLs will not work unless you use the basehref tag. BASEHREF is not a CF tag, it's standard HTML. SES URLs mess up your relative links when this tag is not used.
In the <HEAD> section of your templates, headers, Fusebox Layout files, etc, include this code:
<CFIF IsDefined("variables.baseHref")> <cfoutput><base href="#variables.baseHref#"></cfoutput> </CFIF>You can change the name of the variable used by modifying SESrBaseName (see above in the code used to cfinclude sesConverter). By default, this variable is set to "baseHREF."
Compatability
sesConverter works for ColdFusion 4.5.1 and above. This should work with Apache, IIS, and other less popular web servers like NetPlanet and even CFMX's built in server.sesConverter is Framework Independent. This means it will work with Fusebox 8, Mach VII, etc. Using your head and verifying sesConverter is executed before your framework will solve 99% of your problems.
Having Troubles?
- Verify the BASEHREF tag is in your templates as described above
- Javascript isn't smart enough to parse SES URLs. Don't use relative links with Javascript when using SES URLs -- use absolute.
- Download the ses Demo application from Fusium for an example implementation
- Statistics not showing the right things? Make sure you're logging the full URL (via your web server configuration).
CFMX Issues:
If you don't want to use dummy files, you may have troubles using SES URLs with CFMX. The solution is to modify the web.xml file. Mine is located in:C:/Inetpub/wwwroot/WEB-INF/web.xmlYours could be somewhere else. If you're using CFMX's built in server, try looking in
C:/ColdFusionMX/wwwroot/WEB-INF/web.xml.
Add the following servlet mapping:
<servlet-mapping> <servlet-name>CfmServlet</servlet-name> <url-pattern>*</url-pattern> </servlet-mapping>For some reason, CFMX needs this, even though there is already a mapping *.cfm/*
It's important to note that if you're running a real web server (ie not CFMX's test server) you'll have two web.xml files on your machine. I'd add the above directive to both files in case you go back and test something with the integrated web server.
IIS Issues:
- Problems when using international characters in SES urls - caused by IIS Lockdown setting. To fix, edit urlscan.ini file and set AllowHighBitCharacters=0.
- For Windows NT, if you are using any service pack over SP5, you can not use .htm as a dummy extension. Use .cfm instead.
- IIS 5 - check a file named urlscan.ini, located somewhere like c:\winnt\system32\inetsrv\urlscan\. If found, make sure the setting AllowDotInPath is set to 1 (Joseph DeVore).
- Perhaps IIS is trying to verify the template exists. If so (from cfhub):
- Open the IIS management console.
- Right click on your web site. Choose properties
- In the "Directory" or "Home Directory" tab find the "Configuration" button.
- Click "Configuration"
- In the Configuration window locate all the associations you have made to iscf.dll (likely just ".cfm" but not always)
- Click on ".cfm"
- See the "Check that file exists" box?
- Be sure it is not checked.
- "Apply" the changes and close the properties boxes and the IIS console.