301重定向的新网站 [英] 301 redirect for new website

查看:139
本文介绍了301重定向的新网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的网站www.mysite.com/index.php 和一个新的网站www.mysite.com/cms/index.php

如何是从古时的页面重定向到新的网站最好的方法是什么? 因为人老书签页面就像mysite.com/contact,我喜欢把它重定向到:mysite的/ CMS / contact_us.php

我知道,我可以删除旧网站,并把新的根目录下,我可以做一个htacces 301,但我吮吸的书写规则,如:所有mysite.com/*到mysite.com/cms

任何想法或GUI写作htaccess的?

感谢

解决方案

也许这样的事情?

  RewriteEngine叙述上
的RewriteCond%{REQUEST_URI}!^ / CMS /.*
重写规则(^ * $)/ CMS / $ 1
 

这将重定向的一切,这不是在/ CMS /有。例如 /联系人将转化为 / CMS /接触

I have an old site www.mysite.com/index.php and a new site www.mysite.com/cms/index.php

How is the best method to redirect all the page from the old to the new site ? because people have bookmark old page like mysite.com/contact and i like to redirect it to : mysite/cms/contact_us.php

i know, i can delete the old site, and put the new at root level, i can do a htacces 301, but i sucks at writing rules like : all mysite.com/* to mysite.com/cms

any idea or gui for writing htaccess ?

thanks

解决方案

Maybe something like this?

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/cms/.*
RewriteRule (^.*$) /cms/$1

This will redirect everything that's not within /cms/ there. For example /contact will translate to /cms/contact.

这篇关于301重定向的新网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆