这是重定向URL的最干净的方法。 快速,简单且对搜索引擎友好。 请记住,HTAccess内容仅适用于Apache服务器。
重定向单个页面
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html
Redirect 301 /oldpage2.html http://www.yoursite.com/folder/
重定向整个站点
这样就可以保持链接完好无损 。 即www.oldsite.com/some/crazy/link.html将变为www.newsite.com/some/crazy/link.html。 当您只是将网站“移动”到新域时,这非常有用。 将其放在OLD网站上:
Redirect 301 / http://newsite.com/
翻译自: https://css-tricks.com/snippets/htaccess/301-redirects/