English 中文(简体)
301 转站没有在协会工作
原标题:301 Redirect is not working in ASP

我已经从所有方面着手,他们都说了同样的事情。 I m试图将单页移至新圆页。 这里是我所看到的守则,并试图在所涉网页的开头多次放置:

<%@Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader ( "Location","http://www.new-location.com" )
%>

It does not seem to work. It looks like typical .asp page swith the <@ Language=VBScript %> at the top followed by html code. Is there another way to redirect single .asp pages?

问题回答

我认为,家长们是这里的麻烦。

<%@Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.new-location.com"
%>

Try this...

<%@ language="VBScript" %>
<% 
Response.Status="301 Moved Permanently" 
Response.AddHeader ( "Location","http://www.new-location.com" ) 
%> 

I know I am very late, but if you have HTML following the redirect you will need to use Response.End():

<%@ language="VBScript" %>
<% 
Response.Status="301 Moved Permanently" 
Response.AddHeader ( "Location","http://www.new-location.com" ) 
Response.End()
%> 




相关问题
How to use redirect_to to a non-Rails URL with query params?

We just had an existing use of redirect_to break due to a Rails upgrade, and it led to a question. I ve been experimenting, and I don t seem to find a way to use redirect_to to send the user to a non-...

Apache authentication: Redirect on failure, reliably?

I ve set my ErrorDocument 401 to point to my website s account creation page, but not all browsers seem to honor this redirect (Safari). Also, other browsers (Firefox, Chrome) never quit asking for ...

Response.Redirect HTTP status code

Why is it that ASP/ASP.NET Response.Redirect uses a HTTP-302 status code ("Moved Temporarily") even though in most cases a HTTP-301 status code ("Moved Permanently") would be more appropriate?

Exceptions: redirect or render?

I m trying to standardize the way I handle exceptions in my web application (homemade framework) but I m not certain of the "correct" way to handle various situations. I m wondering if there is a ...

Cakephp is not redirecting properly when pages are cached

I am having some issues with a site that was working correctly until i implemented full page caching in CakePHP. I have followed the guidance in the Manual and have my $session->flash in a no-cache ...

热门标签