如何在ColdFusion中重定向并控制状态代码(即301而不是302) [英] How do you redirect in ColdFusion and control the status code (i.e. 301 instead of a 302)

查看:158
本文介绍了如何在ColdFusion中重定向并控制状态代码(即301而不是302)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码执行重定向,但使用302状态代码:

 < cflocation url =http:// stackoverflow.comaddToken =no/> 

我在互联网上发现了这个,但我认为它只能在ColdFusion8中使用。我使用ColdFusion7。

 < cflocation url =http://stackoverflow.comaddToken =nostatuscode =301 ;你是否控制ColdFusion7中的状态代码?



$ b =h2_lin>解决方案

< cfheader statuscode =301statustext =Moved permanently>
< cfheader name =Locationvalue =http://stackoverflow.com>


This code does a redirect, but uses a 302 status code:

<cflocation url="http://stackoverflow.com" addToken="no" />

I found this on the Internet, but I think it only works in ColdFusion8. I am using ColdFusion7.

<cflocation url="http://stackoverflow.com" addToken="no" statuscode="301" />

Hoe do you control the status code in ColdFusion7?

解决方案

<cfheader statuscode="301" statustext="Moved permanently"> <cfheader name="Location" value="http://stackoverflow.com">

这篇关于如何在ColdFusion中重定向并控制状态代码(即301而不是302)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆