Redirects - The MDN project 编辑

Sometimes you need to have a page that redirects to another page, or to a section of another page. This article describes how to create redirects.

Creating a redirect

Redirects may be needed if a page is merged into another page at some point after its creation, for example. To create a redirect, click the redirect button in the toolbar, which looks like this: .

This brings up a dialog box asking for the name of the destination document and its URL. The name isn't incredibly important; it's mostly useful if you're looking at the redirect page itself and want to know what you're redirecting to. The URL must be a full path from the base of the site, like "/en-US/docs/foo". Relative URLs will not work. However, you can specify a section within the target page using a hashmark ("#") character, such as "/destination/url/here#section_name". This lets you redirect the user straight to that section of the target page.

The redirect should be the only content on the page; before creating your redirect, move all content to its new home. Also, clear any review flags on the original page, to avoid having a mysterious entry in the needs-review listings.

Note: Most importantly, remove all tags from redirect pages. If you don't, the redirect page will show up in search results along with the destination page (assuming they have the same tags), confusing readers and using up valuable space in the search results page. This may also negatively impact SEO.

When deleting pages

Before asking for a page to be deleted, consider whether it would be better to turn the page into a redirect to another page on MDN. If a user comes to the page due to an old link, it's better to send them to the right page on the site than to have them get a 404 ("page not found") error. Outright deletion of pages is a last resort, typically reserved for spam and other wholly inappropriate content.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:67 次

字数:2369

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文