如何执行 htaccess modrewrite 来重定向 url?

发布于 2024-09-27 11:11:06 字数 435 浏览 0 评论 0原文

有一个紧急问题,我完全被难住了。

我们最近迁移了一堆网络博客,并意识到其中一个使用的是子文件夹结构,而所有新系统都是子域。 WordPress 多站点系统不允许同时使用子域和子文件夹结构,因此我猜测逻辑解决方案是使用 htaccess 将旧网址的请求重定向到新网址。但是htaccess中的代码怎么写呢?

我需要向 http://www.mysite.com/720/etcetc 发出所有请求 到 http://blog.mysite.com/etcetc

这可能还是有其他更可行的解决方案?

我们将非常感谢您的帮助。

提前致谢。

Got an urgent issue, and I'm totally stumped.

We recently migrated a bunch of networked blogs, and realized one of them was using a subfolder structure, whereas all the new system is all subdomains. The wordpress multisite system doesn't allow for both subdomains and subfolder structures, so I'm guessing the logical solution would be to use htaccess to redirect requests for the old urls to the new url. But how do I write the code in the htaccess?

I need to make all requests to http://www.mysite.com/720/etcetc
to http://blog.mysite.com/etcetc

Is this possible or is there another more viable solution?

Your assistance would be greatly greatly appreciated.

Thanks in advance.

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

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

发布评论

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

评论(1

沫离伤花 2024-10-04 11:11:06

我的建议是在您运行的任何网站上安装 重定向 插件 http://www.mysite.com/ 并让它动态地将所有对 /720/etcetc/* 的请求重定向到新地址。重定向可以添加适当的 HTTP 301 标头,并且由于它是动态执行的,因此您无需搜索每个 URL 来写入 .htaccess 文件。

My recommendation would be to install the Redirection plug-in on whatever site you have running at http://www.mysite.com/ and have it dynamically redirect all requests to /720/etcetc/* to the new address. Redirection can add the appropriate HTTP 301 headers and, since it's doing things dynamically, you won't need to hunt down each and every URL to write your .htaccess file.

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