2010-06-15 60 views
0

这个自定义404页面应该工作吗?它是由另一个开发者创建... 运行IIS7自定义404 - 这项工作?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> 

<% 
strQString=lcase(Request.ServerVariables("QUERY_STRING")) 
If (Len(strQString)>4) Then 
    strURL=Right(strQString,Len(strQString)-4) 
    If (instr(lcase(strQString),"www")>1) then 
    strURL = Replace(lcase(strURL),"www","www2") 
    Else 
    strURL = Replace(lcase(strURL),"http://","http://www2.") 
    End If 
End If 
%> 

<HTML> 
<HEAD> 
<META HTTP-EQUIV="refresh" CONTENT="3;URL=<%=strURL%>"> 
<style> 
BODY{ 
color: black; 
font-family: Arial; 
text-align: center; 
} 
H1{font-size: 16px;} 
H2{font-size: 12px;} 
</style> 
</HEAD> 
<BODY> 
<img src="http://example.ca/_bin/images/logo.jpg"/> 
<H1><%=Replace(strQString,"404;","")%> - cannot be found.</H1> 
<H2> Attempting to redirect to <a href="<%=strURL%>"><%=strURL%></a> ...</H2> 
</BODY> 
</HTML> 

回答

0

如果你关心SEO不建议这类事情。 要么解决500个错误的问题,要么为301错误设置301 PERMANENT REDIRECT,但动态重定向不会被机器人看好。

+0

感谢您的评论。我们并不担心机器人,因为子文件夹仅适用于我们为员工托管的Web应用程序的现有链接。 – Kolten 2010-06-15 16:54:39