• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Confused: Can I do URL rewrite in Application.cfc?

Guest
Jul 03, 2007 Jul 03, 2007

Copy link to clipboard

Copied

My current website uses old fashioned links like:
mysite.com/topic.cfm/?id=600

I'd like to rewrite them so they look like:
mysite.com/topics/this-topic-is-interesting-600

Note there is no ".cfm" in the new URL.

Its easy enough to rewrite the links, but how do I handle the HTTP requests in application.cfc? I was assuming there was a variable I could set so that if the URL contained "topics/" I could tell CF to process topic.cfm .. but I can't find it.

Do you need to intercept and parse the requests outside of CF?
TOPICS
Advanced techniques

Views

571

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 03, 2007 Jul 03, 2007

Copy link to clipboard

Copied

Do you need to intercept and parse the requests outside of CF?

Yes, in the web server; IIS, Apache, ect. Without the normal .cfm
extension the request is not getting passed to the CF engine by the web
server. You need to do the rewriting there so that the web server knows
what to do with these types of requests.

By the time the request has gotten to Application.cfm the system has
determined that it is a coldFusion resource.

Now a common middle ground would be URLS like
mysite.com/topic.cfm/this-topic-is-interesting/600.

This will get passed to ColdFusion and there is code out there that will
process the extra 'directories' into the URL parameters they are meant
to replace and use them as such.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 03, 2007 Jul 03, 2007

Copy link to clipboard

Copied

LATEST
Thank you Ian, I have it working now using one of the third-party URL rewriting packages.. I appreciate the help, you saved me hours (if not days) of frustration.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation