重定向的话,只需要给浏览器返回301状态码就行,具体的操作需要看不同的服务端的配置
nginx服务端
如:
server {
listen 443;
server_name example.com;
return 301 $request_uri;
}
当然如果是http的话
server {
listen 80;
server_name morethink.cn;
return 301 $request_uri;
}
(www.3105.cn) tomcat服务端
在WEB-INF下新建urlrewite.xml文件,加入跳转规则
<urlrewrite>
<rule>
<name>seo redirect</name>
<condition name="host" operator="notequal">^www.example.com</condition>
<condition name="host" operator="notequal">^localhost</condition>
<from>^/(.*)</from>
<to type="permanent-redirect" last="true">/$1</to> </rule>
</urlrewrite>
https的话,就把 http修改为https即可
相关标签: # seo怎么重定向
最新留言