I have never fully implemented sef urls in coldfusion. I have a trick I use in the htaccess which allows me to link to a shorter url (without the trailing .cfm)
for ex: site .com/page >> displays page.cfm
I would like to link to a page & pass sef friendly variables in this manner:
Where location.cfm is a page, and the last 3 parts are variables. Can this or something similar be done?
So the URL looks pretty, but the application.cfc looks at the url.ses variable and begins to process that. You can process that value any way you want. We chose to make it a /-delimited list where the first value was the folder they were requesting and the next was the file name. Any variables after that were part of variables sent to that page (the database for the page determined how many url vars that page supported)
The script would then look in the portfolio folder for the websites.cfm page, and poll the database. The database would say, in short “this page supports 1 URL variable called pid”. So the script would continue to process the URL and create a url.pid variable and then set it to project1.
Very cool. Thank you for posting. Do I need micronovae to implement a solution if I am on an apache webserver… or just use the script properly? Could you share a little more regarding the script itself?
I think Micronovae’s script is to emulate what MODREWRITE does on Apache already; it just offers it for people who are using IIS (which I am using) The .htaccess files that MODREWRITE uses in Apache are now supported in like 95% of their functionality via Micronovae’s Mod Rewrite.
Since you’re on Apache, I assume you would just have your .htaccess file rewrite similar to how I explained, and then have your application.cfc process the request when it gets rewritten internally.