Coldfusion 重定向状态码为 410 的页面
我的网站动态生成链接,一段时间后链接将过期并且不再有效。
我将此类链接重定向到状态代码为 301 的静态页面,这对于 Google 来说仅意味着旧链接应替换为新链接。
但我想要的是,我应该能够将状态代码设置为 410,并且应该能够将页面重定向到我的静态页面,以便搜索引擎应该从其索引中删除此类链接。
我面临的问题是,通过像
<cfheader statuscode="410" statustext="Gone">
<cfheader name="Location" value="/removed.cfm">
<cfabort>
浏览器一样设置标头不会重定向到新位置。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
状态 410 不是重定向。与 301/302 相比,它更类似于 404。使用状态 301 进行永久重定向,Google 应该识别出旧页面已被替换,并且浏览器将进行重定向。
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.
认为
cflocation
和statusCode
就是您想要的。来自 手册:我不确定它是否有效代码为 410,但我同意 Ben 的观点,即 301 在这里听起来更好。
Think
cflocation
withstatusCode
is what you want. From manual:I'm not sure if it work with code 410, but I would agree with Ben that 301 sounds better here.