<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
php只有一种方法,利用JavaScript的window.location是一种方法,利用html的meta的Refresh是一种方法。
代码
php的header
Header("Location: http://www.dreamdu.com/xhtml/");
JavaScript的window.location
echo "<script>window.location=/"http://www.dreamdu.com/xhtml//";</script>";
HTML的meta的refresh
echo "<meta http-equiv=/"refresh/" content=/"0; url=http://www.dreamdu.com//" />";
当时使用php的header方法是也可以为跳转定义html状态码
比如:
Header("HTTP/1.1 301 Moved Permanently"); Header("HTTP/1.1 307 Temporary Redirect"); Header("HTTP/1.1 303 See Other");
html状态码,可以在http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html里查看
如果是永久性的重定向,考虑到seo可以使用下面代码
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://www.dreamdu.com/xhtml/");