如何将根站点 301 到新文件夹但允许根上的新网站
好吧,让我看看是否可以轻松解释这一点。
我有一个论坛,分别作为我的主页托管在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这需要做很多工作。
您的 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) andhttp://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
tohttp://www.mysite.com/forum/forum-link
. You're probably going to have to write aRewriteRule
for every uniqueforum-link
you have.One better possibility would be to put the new CMS pages at
http://www.mysite.com/cms
and redirecthttp://www.mysite.com
there./*?no_redirect
之外的所有请求,将重定向设置为/forum/*
。/[requested_url]?no_redirect
。/forum/*
for all requests except/*?no_redirect
./[requested_url]?no_redirect
.