表单提交后使用 301,302 重定向是否不好
处理表单提交后使用 301、302 重定向是否不好?或者只建议用于“真正被移动”的页面。如果我使用重定向,我可以向用户显示漂亮的网址。
请指教。
谢谢
Is it bad to use 301, 302 redirects after processing a form submission. Or is it only advised to use for pages that have "really been moved". I can show users nice urls if I use redirects.
Please advice.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,这还不错。它实际上是推荐的最佳实践,称为 PRG(POST、重定向、GET)。这可以防止用户看到令人讨厌的“您真的想再次发送此表单吗?”信息。
建议您发送303(查看其他)或302(找到)。 301 表示该资源已永久迁移。
No, it is not bad. It's actually recommended best practice and called PRG (POST, Redirect, GET). This prevents users from seeing the nasty "Do you really want to send this form again?" message.
It's recommended that you send 303 (See Other) or 302 (Found). 301 is saying that this resource has been relocated permanently.
如果您将用户重定向到新创建的对象,
302 Found
听起来有效。但是,请注意,某些网络安全扫描程序(如 BlueCoat)可能希望阻止此类重定向。
302 Found
sounds valid, if you are redirecting the user to the newly created object.However, be aware that some network security scanners (as BlueCoat) may wish to block such redirections.