DG3
DG3

Reputation: 5298

What does this URL mean?

http://localhost/students/index.cfm/register?action=studentreg 

I did not understand the use of 'register' after index.cfm. Can anyone please help me understand what it could mean? There is a index.cfm file in students folder. Could register be a folder name?

Upvotes: 1

Views: 446

Answers (4)

Jim Harris
Jim Harris

Reputation: 121

index.cfm is using either a CFIF IsDefind("register") or a CFIF #cgi.Path_Info# CONTAINS statements to execute a function or perform a logic step.

Upvotes: 0

Sergey Galashyn
Sergey Galashyn

Reputation: 6956

You want to look into the cgi.PATH_INFO variable, it is populated automatically by CF server when such URL format used.

Better real-life example would look something like this.

I have an URL which I want to make prettier:

http://mybikesite/index.cfm?category=bicycles&manufacturer=cannondale&model=trail-sl-4

I can rewrite it this way:

http://mybikesite/index.cfm/category/bicycles/manufacturer/cannondale/model/trail-sl-4

Our cgi.PATH_INFO value is: /category/bicycles/manufacturer/cannondale/model/trail-sl-4

We can parse it using list functions to get the same data as original URL gives us automatically.

Second part of your URL is plain GET variable, it is pushed into URL scope as usually.

Both formats can be mixed, GET vars may be used for paging or any other secondary stuff.

Upvotes: 1

Yisroel
Yisroel

Reputation: 8174

ColdFusion will execute index.cfm. It is up to the script to decide what to do with the /register that comes after.

This trick is used to build SEO friendly URL's. For example http://www.ohnuts.com/buy.cfm/bulk-nuts-seeds/almonds/roasted-salted - buy.com uses the /bulk-nuts-seeds/almonds/roasted-salted to determine which page to show.

Whats nice about this is it avoids custom 404 error handlers and URL rewrites. This makes it easier for your application to directly manage the URL's used.

I don't know if it works on all platforms, as I've only used it on IIS.

Upvotes: 1

Craig White
Craig White

Reputation: 14002

They might be using special commands within their .htaccess files to modify the URL to point to something else.

Things like pointing home.html -> index.php?p=home

Upvotes: 1

Related Questions