如何将根站点 301 到新文件夹但允许根上的新网站

发布于 2024-09-09 03:07:44 字数 592 浏览 2 评论 0原文

好吧,让我看看是否可以轻松解释这一点。

我有一个论坛,分别作为我的主页托管在 www.mysite.com 上。它的索引很好,我不想失去任何排名。

今天,我将整个根站点从根域移至 www.mysite.com/forum,为我们的新 CMS 系统让路,该系统现在将成为主页。 (这是为了帮助新用户并轻松引导访客到我们的新商店)

目前我在我的 htaccess 文件中使用它,

    RewriteEngine on

RewriteCond $1 !^Home
RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com$
RewriteRule ^(.*)$ "http\:\/\/www\.mysite\.com\/forum\/$1" [R=301,L]

正如您所看到的,它负责重定向,同时仍然允许我访问位于 /home 的 cms

这是一个价值百万美元的问题:

有没有办法将 CMS 放入根域,同时仍然重定向所有旧的论坛链接?我感谢您的帮助并希望我正确地解释了自己:)

Ok let me see if I can explain this easily

I have a forum that was hosted as my home page on www.mysite.com respectively. It's well indexed and I'd hate to lose any ranking.

Today I moved the entire root site from the root domain to www.mysite.com/forum to make way for our new CMS system which will now be the home page. (This is to help new users and easily guide visitors to our new store)

Currently I'm using this in my htaccess file

    RewriteEngine on

RewriteCond $1 !^Home
RewriteCond %{HTTP_HOST} ^mysite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite.com$
RewriteRule ^(.*)$ "http\:\/\/www\.mysite\.com\/forum\/$1" [R=301,L]

As you can see this takes care of redirects while still allowing me to access the cms located on /home

Here's the million dollar question:

Is there way to put the CMS onto the root domain while still redirecting all of the old forum links? I appreciate your help and hope I explained myself correctly :)

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

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

发布评论

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

评论(2

江南烟雨〆相思醉 2024-09-16 03:07:44

这需要做很多工作。

您的 HTTP 服务器不会识别 http://www.mysite.com/(旧论坛链接)和 http://www.mysite.com/ 之间的区别>(新的 CMS 链接)。

然而,这是一个很大的问题,您可以将所有 http://www.mysite.com/forum-link 重定向到 http://www.mysite.com/forum /论坛链接。您可能必须为您拥有的每个唯一的forum-link 编写一个RewriteRule

一种更好的可能性是将新的 CMS 页面放置在 http://www.mysite.com/cms 并在那里重定向 http://www.mysite.com

It would take quite a bit of work.

Your HTTP server won't know the difference between http://www.mysite.com/ (the old forum link) and http://www.mysite.com/ (the new CMS link).

However, and this is a big however, you can redirect all of the http://www.mysite.com/forum-link to http://www.mysite.com/forum/forum-link. You're probably going to have to write a RewriteRule for every unique forum-link you have.

One better possibility would be to put the new CMS pages at http://www.mysite.com/cms and redirect http://www.mysite.com there.

街道布景 2024-09-16 03:07:44
  1. 对于除 /*?no_redirect 之外的所有请求,将重定向设置为 /forum/*
  2. 为 /forum 目录编写 404 错误处理程序。它应该将用户重定向到 /[requested_url]?no_redirect
  1. Set redirect to /forum/* for all requests except /*?no_redirect.
  2. Write 404 error handler for /forum directory. It should redirect user to /[requested_url]?no_redirect.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文