百度 | 神马 | 搜狗 | 技术文档 | 学习资料分享 - 记录帝国CMS及运维技术的点点滴滴
你的位置:首页 > 服务器管理 » 正文

Nginx服务器几个常见经典CMS伪静态代码(带301重定向)

发布时间:2021-01-08

作品分类:

第一个帝国CMS的nginx伪静态代码


# nginx configuration by winginx.com

location / {
  if ($http_host ~* "^(ssh5\.cn)(:80)?"){
    rewrite ^/(.*) http://www.ssh5.cn/$1 redirect;
  }
}

location /tags {
  rewrite ^/tags-(.*)-(.*)$ /e/tags/index.php?tagid=$1&page=$2;
}

location /plug {
  rewrite ^/plug/tags\.asp(.*)$ /e/tags/?tagname=$1 redirect;
}

第二个:Wordpress重定向代码

wordpress程序需要设置域名,因此cms自动回跳转到设置的域名,伪静态不需要做什么,如下书写即可。
location /
{
     try_files $uri $uri/ /index.php?$args;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

第三个:wellcms 301重定向代码

location / {
    rewrite ^/p/(.*)$ /read-$1 permanent;
    if ($http_host ~* "^(budapei\.com)(:80)?"){
    rewrite ^/(.*) http://www.budapei.com/$1 redirect;
  }
    if (!-e $request_filename) {
        rewrite ^((.*)/)?(.*).html$ $1/index.php last;
    }
}
    


以上代码仅供参考,更多SDCMS,pb等等的301代码可以联系小北或者奥巴牛。

相关内容推荐:

Top