user160820
user160820

Reputation: 15220

Coldfusion Redirecting a page with statuscode 410

my web site generate the links dynamically and after some period of time the links will be expired and will be no more valid.

I redirect such links to a static page with a statuscode 301 which for google only means that the old link should be replace with this new link.

But what I want is that I should be able to set the statuscode to 410 and should be able to redirect the page to my static page so that the search engine should remove such links from their indexes.

The problem I am facing is that by setting header like

<cfheader statuscode="410" statustext="Gone"> 
<cfheader name="Location" value="/removed.cfm">  
 <cfabort>  

the browser does't redirct to new location.

Upvotes: 2

Views: 1023

Answers (2)

Ben Doom
Ben Doom

Reputation: 7885

Status 410 is not a redirect. It is more similar to a 404 than a 301/302. Use status 301 for a permanent redirect, and Google should recognize that the old page has been replaced, and browsers will redirect.

Upvotes: 5

Sergey Galashyn
Sergey Galashyn

Reputation: 6956

Think cflocation with statusCode is what you want. From manual:

<cflocation
    url = "URL"
    addToken = "yes|no"
    statusCode = "300|301|302|303|304|305|307" />

I'm not sure if it work with code 410, but I would agree with Ben that 301 sounds better here.

Upvotes: 2

Related Questions