将旧页面重定向到新页面 HTML
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15127708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Redirect old page to new page HTML
提问by karthikeyan
Old website like this: www.example.com/oldnews.html
像这样的旧网站:www.example.com/oldnews.html
oldnews.html page changed to now newnews.html
oldnews.html 页面更改为现在的 newnews.html
New website like this: www.example.com/newnews.html
像这样的新网站:www.example.com/newnews.html
When type any one www.example.com/oldnews.html automatically page redirected to new page =>
当输入任何一个 www.example.com/oldnews.html 时,页面会自动重定向到新页面 =>
www.example.com/newnews.html
www.example.com/newnews.html
How to page redirect old page to new page?
如何将旧页面重定向到新页面?
Use an .htaccess file?
使用 .htaccess 文件?
回答by Dipesh Parmar
Try this for HTML5
试试这个用于 HTML5
<meta http-equiv="refresh" content="0";url='http://www.yourdomain.com/newindex.html'">
I see below it says "Use 301 redirects if you are willing to use server-side. Meta tags, as described in the other answer, are best for client-side."
我在下面看到它说“如果您愿意使用服务器端,请使用 301 重定向。元标记,如另一个答案中所述,最适合客户端。”
Any redirect done in the code or on a server is called server-side. When we make a change in Firefox or Chrome or any browser that changes the way an end-user interacts with the web it is called client-side.
在代码中或在服务器上完成的任何重定向都称为服务器端。当我们在 Firefox 或 Chrome 或任何改变最终用户与网络交互方式的浏览器中进行更改时,它被称为客户端。
Reference: https://www.w3.org/TR/WCAG20-TECHS/H76.html
回答by markasoftware
Use 301 redirects if you are willing to use server-side. Meta tags, as described in the other answer, are best for client-side.
如果您愿意使用服务器端,请使用 301 重定向。如另一个答案中所述,元标记最适合客户端。