我有一个页面 http://site.com/services/ ,我只是想重定向它 http://site.com/servics/first-service/
I have a page at http://site.com/services/ and I just want to redirect it to http://site.com/servics/first-service/
最新最好的重定向做到这一点,我怎么做到这一点?
Whats the best redirect to do this and how do I do this?
PHP
header("Location: yourpage.php");
exit;
您必须使用退出
或模具
在头
以停止执行你的code。
此外,code有任何输出之前执行。
You have to use exit
or die
after header
in order to stop execution of your code.
Also, the code has to be executed before any output.
HTML
<meta http-equiv="refresh" content="0;url=yourpage.php">
在code之间应&LT; HEAD&GT;&LT; /头&GT;
标签
的JavaScript
window.location = "yourpage.php";
的.htaccess
.htaccess:
Redirect 301 /oldpage.php /newpage.php