java - Redirect to an url but showing a different url in the bar adress using tomcat
问题描述
When the website is full, I redirect the users to a try_later_page.html, and told them to try after a few moment, But I want in that instant, that the adresse bar to contain mysite.com, and not the url mysite.com/try_later_page.html, so when the user try an F5 he will be send to the index page,
How can I do this ?
解决方案
您必须使用 aforward
而不是 a redirect
。转发是服务器实习生并重新路由到新内容。浏览器对此重新路由一无所知,并停留在以前的 url 上。所以当用户F5
在浏览器内使用时,我们会再次调用之前的站点(不是目标站点forward
)。
推荐阅读
- python - 如何在不影响其余部分的情况下延迟我的程序的一部分?
- javascript - 使用 JavaScript 按其类隐藏 li 的元素
- c++ - 模板问题
- vb.net - 如何限制一次产生的进程数?
- python - 在 Windows 上将 python 3.8 降级为 3.7 后如何在 PyCharm 中配置解释器?
- excel - 导出为 PDF 时,冻结的窗格会被部分裁剪
- java - 避免在 XML 中使用 Transformer 写入输出文件
- javascript - 如何在父组件中获取渲染的子组件?
- sql - 使用数据库中的数据更新 Excel 列表
- excel - 从 Excel 发送带有 pdf 附件的 Outlook 电子邮件并禁用 Outlook 附件上下文菜单