HTML如何做301跳转

html-css0187

HTML如何做301跳转,第1张

html是做不了301跳转的,但是可以通过

在5秒后,自动跳转到同目录下的hello.html(根据自己需要自行修改)文件。

下面列了五个例子来详细说明,这几个例子的主要功能是:在5秒后,自动跳转到同目录下的hello.html(根据自己需要自行修改)文件。

1)

html的实现

<head>

<!-- 以下方式只是刷新不跳转到其他页面

-->

<meta http-equiv="refresh"

content="10">

<!-- 以下方式定时转到其他页面

-->

<meta http-equiv="refresh"

content="5url=hello.html">

</head>

优点:简单

缺点:Struts Tiles中无法使用

2)

javascript的实现

<script

language="javascript"

type="text/javascript">

// 以下方式直接跳转

window.location.href='hello.html'

// 以下方式定时跳转

setTimeout("javascript:location.href='hello.html'",

5000)

</script>

优点:灵活,可以结合更多的其他功能

缺点:受到不同浏览器的影响

3)

<script

language="javascript"

type="text/javascript">

var second =

document.getElementByIdx_x('totalSecond').textContent

setInterval("redirect()", 1000)

function redirect()

{

document.getElementByIdx_x('totalSecond').textContent = --second

if (second < 0) location.href

= 'hello.html'

}

</script>

参考我回复其他人的页面:http://zhidao.baidu.com/question/1882892067218382988

301是定向错误,需要你重新搞下域名。301错误主要是域名更换后,搜索引擎还在使用原有域名访问你的网站,如果得到的是一个301错误,那么搜索引擎就知道你已经更换了域名,下次就会使用新域名来索引你的网站,当然你要告诉搜索引擎你的新域名是什么