Reply to topic
404 type error on coldfusion
calidude


Joined: 09 Jun 2006
Posts: 10
Location: Redding, CA
Reply with quote
I have several coldfusion storefronts hosted on HMS. Many have been moved and rebuilt from prior storefronts so the search engines are serving up old coldfusion pages. For the standard html pages I just put up a custom 404 page but for the coldfusion pages I have not foud a solution. I did find and older post about the application.cfm page but am worried about putting any code there since one already exists for the storefront application. Does anyone have any ideas how I can redirect customers who enter the site through an old cf page? This causing loss of business for some of my ecommerce clients.

Thaniks in advance for the input.

Bob
CFHeader
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 550
Location: Harrisburg, PA
Reply with quote
Hey there.

It's OK to use multiple Application.cfm files in one application. Coldfusion goes up the directory tree until It finds an Application.cfm. But keep in mind, the second Application.cfm won't have access to any variables set in the first application.cfm You would have to duplicate everything in the first to the second in order to access the variables.

Secondly, You really shouldn't put 404 errors up. You should generate custom HTTP response headers to return to the client and to Google/Search Engines by using CFHeader.

For instance, if you moved a page and wanted to redirect the user, one might use

Code:

<cflocation  url= "/Products/index.cfm">


Although that works good for a user, search engines don't like redirects to other pages. So you should use <cfheader> as follows:

Code:

    <cfheader statuscode="301" statustext="Moved Permanently">
    <cfheader name="Location" value="/Products/index.cfm">
    <cfabort>


This will tell search engines that your page has moved, and to re index the page at the new location. For a user, it is completely transparent and they will just be redirected.

If I confused you about the application.cfm, let me know and I'll give you a better example.

Hope this helps.
Very Happy
calidude


Joined: 09 Jun 2006
Posts: 10
Location: Redding, CA
Reply with quote
I am a little confused on the application.cfm. Would both exist in the same directory?

Thanks again.
Directories
comprug
Forum Regular

Joined: 15 Feb 2006
Posts: 343
Reply with quote
Code:
I am a little confused on the application.cfm. Would both exist in the same directory?

Thanks again.

Hello, to address your concerns, one Application.cfm would go in the root of your site, but one would go in the old directory to redirect people. The root application.cfm will be in charge of everything except the old directory, as CF looks first in the directory the user is in, and then on a global level. Hope this addresses your concerns.
Oops
Jason101
Forum Regular

Joined: 14 Mar 2006
Posts: 550
Location: Harrisburg, PA
Reply with quote
Sorry for the confusion. Thanks for the clarification Comprug Very Happy
404 type error on coldfusion
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic