现在的位置: 首页 > Godaddy使用说明 > 正文

Godaddy添加默认文档

2008年05月14日 使用说明 ⁄ 共 1006字 ⁄ 字号 Godaddy添加默认文档已关闭评论 ⁄ 阅读 2,499 views 次

有些朋友购买的是Godaddy的windows系列主机,当访问网站时必须在域名后面加index.aspx,否则就无法打开网站,出现这种情况,是因为index.aspx不在默认页面里面,这时你可以加一个index.htm,然后加一个转页面到index.aspx就可以了,这样就需要添加Godaddy的默认文档。用以下代码进行转向,把网址修改为index.aspx:
<html>
<head>
<noscript>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://bbs.idcspy.com">
</noscript>
<script language="JavaScript">
window.top.location.replace ( "http://bbs.idcspy.com" ) ;
</script>
</head>
</html>
使用JAVASCRIPT做转向有一定的弊端,某些浏览器不支持某些JAVASCRIPT代码,有些用户会因为安全原因禁用脚本,这样的话客户就无法访问到INDEX.ASPX了,如果你担心这个问题,你可以用301做服务器转向,代码如下:
asp:
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.XXXX.com/"
Response.End
%>
--------------------------------
Php:
header("HTTP/1.1 301 Moved Permanently");
header("Location:http://www.XXXX.com/);
exit();
--------------------------------------
ASP.NET:
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.XXXX.com/);
}
</script>

以上就是Godaddy添加默认文档的方法。

如果是使用.NET2.0的话,还可以用WEB.CONFIG来作URL重写或转向

抱歉!评论已关闭.