通常来说我以前也没试过nginx下配置杰奇的伪静态,主要是感觉挺麻烦,但是其实在linux下nginx的性能特别给力,所以感觉还是需要研究一下。最近帮一个买家安装程序的时候,顺便就进行配置,出了些问题之后,倒也是搞定了。当然我只是在lnmp下测试杰奇的nginx伪静态配置,实际情况
有一个比较方便转换工具,可以把.htaccess转化为nginx支持的语句:点击进入
以杰奇2.2为例,nginx的伪静态写法如下:rewrite ^//index.html$ /index.php;
rewrite ^/book/([0-9]+)\.html$ /modules/article/articleinfo.php?id=$1 last;
rewrite ^/sort/([0-9]+)/([0-9]+)\.html$ /modules/article/articlelist.php?sortid=$1&page=$2 last;
rewrite ^/fullsort/([0-9]+)/([0-9]+)\.html$ /modules/article/articlelist.php?fullflag=1&sortid=$1&page=$2 last;
rewrite ^/initial/([01A-Z])/([0-9]+)\.html$ /modules/article/articlelist.php?initial=$1&page=$2 last;
rewrite ^/top/([a-z]+)/([0-9]+)\.html$ /modules/article/toplist.php?order=$1&page=$2 last;
rewrite ^/quanben/([a-z]+)/([0-9]+)\.html$ /modules/article/toplist.php?fullflag=1&order=$1&page=$2 last;
rewrite ^/shuku/([a-z]+)_([0-9]+)_([0-9]+)_([0-9]+)_([01A-Z])_([0-9]+)_([0-9]+)_([0-9]+)\.html$ /modules/article/articlefilter.php?order=$1&sortid=$2&size=$3&update=$4&initial=$5&isfull=$6&isvip=$7&page=$8 last;
rewrite ^/author/([0-9]+)\.html$ /modules/article/authorpage.php?id=$1 last;
rewrite ^/html/[0-9]+/([0-9]+)/index\.html$ /modules/article/reader.php?aid=$1 last;
rewrite ^/html/[0-9]+/([0-9]+)/([0-9]+).html$ /modules/article/reader.php?aid=$1&cid=$2 last;
rewrite ^/shuku\.html$ /modules/article/articlefilter.php;
rewrite ^/paihang\.html$ /modules/article/top.php;
rewrite ^/buy\.html$ /buyegold.php;
进入/usr/local/nginx/conf/vhost/文件夹,找到网站对应的conf文件,注意看有没有存在如下代码:location / {
}
如果存在,就直接把伪静态规则放到上面代码之间,如果不存在就自己添加将代码放进去,这样伪静态规则就会直接生效,只需要在杰奇后台进行设置了。
规则之树版权所有,已有百度熊掌号原创保护,转载注明来源