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

Friendly URL's in Coldfusion

New Here ,
Apr 21, 2006 Apr 21, 2006

Copy link to clipboard

Copied

How could I change a typical parameterized URL in my application such as

http://www.domain.com/index.cfm?id=977

to the following friendly URL for example (or similar)

http://www.domain.com/index.cfm/news/sample-headline

Any ideas ?
TOPICS
Advanced techniques

Views

2.6K

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
Contributor ,
Apr 21, 2006 Apr 21, 2006

Copy link to clipboard

Copied

In your example, the variable CGI.PATH_INFO would return the value "/index.cfm/news/sample-headline".

You can treat this as a list delimited by "/" or strip out the name of the script to get the variable information you need.

Is that what you mean?

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
New Here ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

Kind of.

Basically what I have now is when a page gets called from the database table the URL is in the form of

http://www.domain.com/index.cfm?id=977

Is it possible to turn (or mask) the url above into a Search engine friendly URL such as

http://www.domain.com/news/headline (if its a press release)

http://www.domain.com/vacancies/jobtitle (if its a job vacancy) etc...

perhaps based from the metadata?

How would the CGI.PATH_INFO return the value "/index.cfm/news/sample-headline".

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 ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

rambo wrote:
> Kind of.
>
> Basically what I have now is when a page gets called from the database table
> the URL is in the form of
>
> http://www.domain.com/index.cfm?id=977
>
> Is it possible to turn the url above into a Search engine friendly URL such as
>
> http://www.domain.com/news/headline (if its a press release)
>
> http://www.domain.com/vacancies/jobtitle (if its a job vacancy) etc...
>
> perhaps based from the metadata?
>
> How would the CGI.PATH_INFO return the value "/index.cfm/news/sample-headline".
>

http://ray.camdenfamily.com/index.cfm/2005/8/2/Ask-a-Jedi-Working-with-SES-URLs-and-ColdFusion

--
Matt Woodward
mpwoodward@gmail.com
Adobe Community Expert - ColdFusion

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
New Here ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

Thanks for that

How would you use the code below in your site that would change the actual URL ?

<cfset pathInfo = reReplaceNoCase(trim(cgi.path_info), ".+\.cfm/? *", "")>

<cfoutput>
cgi.path_info=#cgi.path_info#<br>
stripped: #pathInfo#
</cfoutput>

E.G.

If my link was
http://www.domain.com/direct/execs/newsdetail.cfm?id=#id#"

How could the code be used to change the above to

http://www.domain.com/direct/execs/newsdetail.cfm/24/04/2006/news-headline

like the examples ray camden has on his site

i.e. http://ray.camdenfamily.com/index.cfm/2006/4/21/Advanced-ColdFusion-Contest-Winner

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 ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

rambo wrote:
> Thanks for that
>
> How would you use the code below in your site that would change the actual URL
> ?
>
> <cfset pathInfo = reReplaceNoCase(trim(cgi.path_info), ".+\.cfm/? *", "")>
>
> <cfoutput>
> cgi.path_info=#cgi.path_info#<br>
> stripped: #pathInfo#
> </cfoutput>
>
> E.G.
>
> If my link was
> http://www.domain.com/direct/execs/newsdetail.cfm?id=#id#"
>
> How could the code be used to change the above to
>
> http://www.domain.com/direct/execs/newsdetail.cfm/24/04/2006/news-headline
>
> like the examples ray camden has on his site
>
> i.e.
> http://ray.camdenfamily.com/index.cfm/2006/4/21/Advanced-ColdFusion-Contest-Winn
> er
>
>
>

I haven't had to mess with SES URLs myself, but there's some additional
information here:
http://www.houseoffusion.com/

Just scroll down a bit for the article "Search Engine Safe (SES) URLs"
by Michael Dinowitz.

Matt

--
Matt Woodward
mpwoodward@gmail.com
Adobe Community Expert - ColdFusion

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
New Here ,
Apr 24, 2006 Apr 24, 2006

Copy link to clipboard

Copied

LATEST
There is an interesting article here:

http://www.webmasterworld.com/forum92/6079.htm

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