如何将一个 WordPress 安装重定向到另一个(两者都在同一域的子目录中)?

发布于 2024-08-24 19:26:57 字数 304 浏览 4 评论 0原文

把我的头发拉到这上面。

我在 /2009 安装了一个 WordPress,在 /2010 安装了一个。我正在尝试将所有对 2009 年网站的请求重定向到 2010 年网站。我已经在根 .htaccess 和 /2009 .htaccess 中尝试了这两种方法:

RewriteRule ^2009.*$ 2010 [R=301,L]

RewriteCond %{REQUEST_URI} ^2009.*$
RewriteRule . 2010 [R=301,L]

但是 2009 站点不断加载。有什么想法吗?

Pulling my hair out over this one.

I have one wordpress install at /2009 and one at /2010. I am trying to redirect all requests to the 2009 site to the 2010 site. I have tried both of these in the root .htaccess and in the /2009 .htaccess:

RewriteRule ^2009.*$ 2010 [R=301,L]

RewriteCond %{REQUEST_URI} ^2009.*$
RewriteRule . 2010 [R=301,L]

But the 2009 site keeps loading. Any ideas?

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

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

发布评论

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

评论(1

因为看清所以看轻 2024-08-31 19:26:57

只是为了澄清:
您在服务器上安装了 WordPress,地址为 /Document/root/2009,可以在浏览器中查看 http://server/2009,并且 wordpress 安装在 /Document/root/2010,可在浏览器中查看 http://server/2010,正确吗?

最简单的方法是登录到服务器,cd /Document/root 并执行以下操作:

mv 2009 2009.backup
ln -s 2010 2009

如果您没有对相关服务器的 shell 访问权限,那么第二个最简单的方法是在 2009 年将 index.php 重命名为 wordpress 并加载这个index.php到它:

<?php
header("Location: http://server/2010/"); /* Redirect browser */
exit;
?>

Just to clarify:
You have a wordpress install on the server at /Document/root/2009, viewable in a browser at http://server/2009, and a wordpress install at /Document/root/2010, viewable in a browser at http://server/2010, correct?

The easiest thing to do is login to the server, cd /Document/root and do this:

mv 2009 2009.backup
ln -s 2010 2009

If you do not have shell access to the server in question, then the second easiest method is to rename the index.php for wordpress in 2009 and load this index.php to it:

<?php
header("Location: http://server/2010/"); /* Redirect browser */
exit;
?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文