Blog / 阅读

nginx 服务器使用伪静态实现 301自定义跳转的方法

by admin on 2014-03-22 12:51:02 in ,



使用伪静态成功实现了从 526net.com 到 www.526net.com 的跳转。

只需要在nginx中添加以下伪静态规则即可:

单个文件或者目录也可以使用此方法做301跳转


rewrite ^([^\.]*)/blog/cms/22\.html$ $1/blog/zz/22.html permanent;

下面是整站 301的方法

if ($host = '526net.com' ) {
rewrite ^/(.*)$ http://www.526net.com/$1 permanent;
}
        if (!-e $request_filename) {
                return 404;
        }




注意事项:需要进行跳转的网址只需要写在第二行即可,跳转到的网址需要加上绝对的地址,即必须加上"http://"
把以上代码中的网址改为你自己的。如果有其他服务器使用伪静态规则实现自定义的跳转功能的欢迎分享。


写评论

相关文章

上一篇:ssh远程登录失败"Write failed:Broken pipe"

下一篇:单路CPU性能排名

评论

写评论

* 必填.

分享

栏目

赞助商


热门文章

Tag 云