本文共 826 字,大约阅读时间需要 2 分钟。
php 页面重定向
HTTP 301 is an SEO friendly way to redirect readers to a page’s new location. There are a lot of benefits of using HTTP 301 Redirect. These benefits can be found in the . or PHP can be both used for sending 301 redirects. The htaccess method can be found in . This post discusses the method that use php to generate the HTTP 301 Redirect.
HTTP 301 是SEO友好的方法,用于将读者重定向到页面的新位置。 使用HTTP 301重定向有很多好处。 这些好处可以在找到。 或PHP均可用于发送301重定向。 htaccess方法可以在 。 这篇文章讨论了使用php生成HTTP 301重定向的方法。
As an example, we will redirect a page to in PHP.
例如,我们将页面重定向到PHP中的 。
The code:
代码:
Or simpler
或更简单
The header("HTTP/1.1 301") part must be used before the location part, otherwise PHP will automatically set the status code to HTTP/1.1 302 Found.
必须在位置部分之前使用header(“ HTTP / 1.1 301”)部分,否则PHP将自动将状态代码设置为HTTP / 1.1 302 Found。
翻译自:
php 页面重定向
转载地址:http://dmlwd.baihongyu.com/