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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论