apache整站跳转
Redirect 301 / http://www.new-site.com/
nginx 整站跳转
rewrite ^/(.*)$
http://www.abc.com/
$1 permanent;
没有www跳到有www
- RewriteCond %{http_host} ^abc.com [NC]
- RewriteRule ^(.*)$ http://www.abc.com/$1 [L,R=301]
zh-cn浏览器跳到google
RewriteCond %{HTTP:Accept-Language} ^zh-cn.*$ [NC]
RewriteRule ^(.*)$ http://www.abc.com [R=301,L]
单页跳转
RewriteCond %{HTTP:Accept-Language} ^zh-cn.*$ [NC]
RewriteRule ^/?$ abc.htm [R=301,L]
home分类跳转到首页
RedirectMatch 301 ^/home.html$ http://www.abc.com/ nginx 下 rewrite ^/home.html$ http://www.abc.com/ permanent;
非www跳到www
server {
server_name abc.com;
rewrite ^(.*) http://www.abc$1 permanent;
}
最后
以上就是柔弱猎豹最近收集整理的关于301代码的全部内容,更多相关301代码内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复