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

How to page request without .cfm extension

New Here ,
Aug 03, 2007 Aug 03, 2007

Copy link to clipboard

Copied

I have a site where I want Fred to enter the url http://www.mydomain.com/fred in his browser and Joe to enter url http://www.mydomain.com/joe. I want to parse the name after the last slash, then send the user (with cflocation) to home.cfm, which will be customized for this user.

I was hoping that my "missing template handler" page would be called (since there are no files called fred.cfm or joe.cfm), and then I could get the name from cgi.SCRIPT_NAME, but it looks like the web server rejects this request first. I know I could just add .cfm to the end of the url (e.g. http://www.mydomain.com/fred.cfm), which WOULD send me to my missing template page, but for aesthetic reasons, I don't want to use the extension. (I want the user to be able to put the url on his business card, and the .cfm tacked on the end doesn't look good.)

Anyone know of a solution? Thanks.
TOPICS
Advanced techniques

Views

726

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
Aug 03, 2007 Aug 03, 2007

Copy link to clipboard

Copied

The CGI.PathInfo variable will contain "/joe" when you go to http://www.mydomain.com/joe

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
Advisor ,
Aug 03, 2007 Aug 03, 2007

Copy link to clipboard

Copied

You will need to configure your web server (IIS, Apache, or other) to handle this. If the web server does not recognize the request as being associated with ColdFusion ( *.cfm ) the missing template handler will never be invoked.

You might try associating the web server's file not found 404 error response with a custom web page or URL containing your redirection logic.

I would be interested in hearing how you resolve this challenge. Please post your solution to the forum.

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
LEGEND ,
Aug 03, 2007 Aug 03, 2007

Copy link to clipboard

Copied

As well as reconfiguring your web server 404 handler to a CFM template
as previously suggested. You can use a form like this -
http:\\myDomain.com\aPage.cfm\Joe. This may or may not appeal to you,
but it is a common method to make "Search friendly urls" that could
fairly easily be adopted for your functionality.

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
Aug 05, 2007 Aug 05, 2007

Copy link to clipboard

Copied

No need to get the servers involved. On test.cfm, place a the following single line of code:
<CFDUMP VAR=#CGI#>
Run http://domain.test.cfm/joe and see what you get for CGI.PathInfo.

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
Aug 05, 2007 Aug 05, 2007

Copy link to clipboard

Copied

LATEST
Duplicate

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