URL重写并强制404

发布于 2024-09-25 21:47:02 字数 257 浏览 2 评论 0原文

我们通过 ourdomain.com/folder 提供内容。

该应用程序的下一个迭代已准备好在 ourdomain.com/folder2 中推出。

如果用户尝试直接访问 ourdomain.com/folder2,他会收到 404。

我需要一个重写规则,该规则在 url ourdomain.com/folder 下提供 ourdomain.com/folder2 的内容,并给出 404 直接访问访问 ourdomain.com/folder2。

We serve our content via ourdomain.com/folder.

The next iteration of the application is ready to be rolled out in ourdomain.com/folder2.

If a user tried to access ourdomain.com/folder2 directly he would get a 404.

I need a to get a rewrite rule that serves the content of ourdomain.com/folder2 under the url ourdomain.com/folder and gives the 404 for direct access to ourdomain.com/folder2.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你另情深 2024-10-02 21:47:03

为什么要麻烦 mod_rewrite 呢?你不能只重命名子目录吗?

mv folder folder.old
mv folder2 folder

Why bother with mod_rewrite? Can't you just rename the subdirs?

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