301重定向单个文件更新URL
问题描述:
如何更新位置标题以重定向到另一个URL?301重定向单个文件更新URL
页代码:
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.example.com/new-url.asp"
%>
现在我访问该页面在浏览器重定向到www.example.com/new-url.asp
。
我需要将URL改为www.example.com/new-url-updated.asp
。
新页面代码:
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.example.com/new-url-updated.asp"
%>
现在我访问该网页,它仍然重定向我www.example.com/new-url.asp
,而不是www.example.com/new-url-updated.asp
。
网站在IIS上运行,Windows Server 2003的
答
防止页面被缓存(参见Response.CacheControl):
Response.CacheControl = "no-cache"
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.example.com/new-url-updated.asp"
的浏览器缓存感动Permanently'强制高速缓存的'HTTP 301先清除。 – Lankymart