【发布时间】:2011-03-24 07:14:10
【问题描述】:
我正在使用 Javascript 和邪恶的 http-equiv 元标记将旧博客重定向到新博客。为了防止机器人重复,我还添加了:
<meta name="robots" content="noindex" />
重定向sn-ps如下:
<!--Execute javascript rediect-->
<script type="text/javascript"><!--//--><![CDATA[//><!--
var url = "http://new_loc.blogspot.com/"
(document.images) ? location.replace(url) : location.href = url;
//--><!]]>
</script>
<!--If the browser can be bothered to refresh with new content,
also works if browser has javascript disabled, in mozilla family -->
<meta http-equiv="refresh" content="0;URL=http://new_loc.blogspot.com/" />
然而,这会将深层链接重定向到 new_loc 的首页,这可能会使传入的读者迷失方向。我希望 javascript 和 http-equiv 技巧的相对链接保持不变。实现这一目标的最佳方法是什么?
【问题讨论】:
标签: javascript html redirect