This content has been marked as final. Show 4 replies
What have you tried? In CF, you can access CGI.PATH_INFO, which is what's populated when you request a URL like:
In this case, CGI.PATH_INFO would contain "/foo/bar/baz"
I want to change the way the actualy URL looks to the search engine. For example, a user search for a product and the broswer sends a query string to the server, soemthing like http://www.ennisproducts.com/cfmx/products/prodType.cfm?PRODTYPE_NUM=17&SECTION_NUM=6&SECT ION_NAME=BATTERY+CABLES
But instead of that long, nasty URL, I want is to be soemthing like http://www.ennisproducts.com/cfmx/products/BATTERY+CABLES
There is a way to do this on the fly but I dont know where to start.
Well, you can make it look like this:
or if you assume the order of the parameters, you can make it look like this:
Then on prodType.cfm, you use CGI.PATH_INFO and break it into a list with "/" as the delimiter. The first value is your PRODTYPE_NUM, 2nd is SECTION_NUM, and 3rd is SECTION_NAME.
It's not a matter of the language you use, but of the server. Use Mod-rewrite on Apache and Isapi_rewrite on IIS.
Isapi_rewrite can be found at:
Rules are then written in a http.ini file in the root of the (virtual) site, your example could be rewritten to:
with this rule:
RewriteRule /(\d+)/(\d+)\/([^/?]+).htm /cfmx/products/prodType.cfm\?PRODTYPE_NUM=$1&SECTION=$2&SECTION_NAME=$3 [I,L]