云优cms如何设置伪静态规则?

2023-12-14 14:25 小编

我们以宝塔面板作为示例说明云优cms如何设置伪静态规则

apache环境

查看自己安装的环境,左侧软件商店,如下图红框所示,证明您已经安装好了apache环境,apache环境对于新手用户是比较友好的,无需任何设置,只要站点根目录存在.htaccess伪静态文件就直接生效

1.jpg

nginx环境

如果您安装的环境是nginx,那么需要左侧点击【网站】-【设置】-【伪静态】,将下面提供的nginx伪静态规则复制进去就可以了

火狐截图_2023-01-10T01-08-37.840Z.png

1
2
3
4
if (!-d $request_filename){   set $rule_0 1$rule_0;
}if (!-f $request_filename){  set $rule_0 2$rule_0;
}if ($rule_0 = "21"){    rewrite ^/(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.htm;
}   rewrite ^/admin/(.*).html$ /index.php?s=admin/$1 last;   rewrite ^/admin/(.*)$ /index.php?s=admin/$1 last;    rewrite ^/config/(.*)$ /404.htm last;    rewrite ^/statics/ueditor/dialogs/(.*)/(.*).html$ /statics/ueditor/dialogs/$1/$2.html last;  rewrite ^/m/$ /index.php?s=wap/index/index last; rewrite ^/m/search/$ /index.php?s=wap/search/index last; rewrite ^/m/myform/$ /index.php?s=wap/myform/index last; rewrite ^/m/captcha/(\d*)$ /index.php?s=wap/myform/captcha&id=$1 last;   rewrite ^/m/(.*)_search/$ /index.php?s=wap/search/index&area=$1 last;    rewrite ^/m/(.*)_tag/([\s\S]*)$ /index.php?s=wap/tag/index&title=$2&area=$1 last;    rewrite ^/m/tag/([\s\S]*)$ /index.php?s=wap/tag/index&title=$1 last; rewrite ^/m/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;    rewrite ^/m/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;    rewrite ^/m/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;   rewrite ^/m/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1 last;   rewrite ^/m/(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1&cw=$3 last; rewrite ^/m/(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1 last;    rewrite ^/m/(.*)/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2 last;  rewrite ^/m/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$2&area=$1 last;  rewrite ^/m/(.*)/(.*)_(.*)/page/(\d*)$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2&page=$4 last;    rewrite ^/m/(.*)_(.*)/page/(\d*)$ /index.php?s=wap/category/index&ctitle=$2&area=$1&page=$3 last;    rewrite ^/m/(.*)/$ /index.php?s=wap/category/index&ctitle=$1 last;   rewrite ^/m/(.*)/page/(\d*)$ /index.php?s=wap/category/index&ctitle=$1&page=$2 last; rewrite ^/m/(.*).html$ /index.php?s=wap/index/index&area=$1 last;    rewrite ^/index(.*)/$ /index.php?s=index/index/index/$1 last;    rewrite ^/myform/$ /index.php?s=index/myform/index last; rewrite ^/(.*)_myform/$ /index.php?s=index/myform/index&area=$1 last;    rewrite ^/captcha/(\d*)$ /index.php?s=index/myform/captcha&id=$1 last;   rewrite ^/(.*)_captcha/(\d*)$ /index.php?s=index/myform/captcha&area=$1&id=$2 last;  rewrite ^/search/$ /index.php?s=index/search/index last; rewrite ^/search/page/(\d*)$ /index.php?s=index/search/index&page=$1 last;   rewrite ^/(.*)_search/$ /index.php?s=index/search/index&area=$1 last;    rewrite ^/(.*)_tag/([\s\S]*)$ /index.php?s=index/tag/index&title=$2&area=$1 last;    rewrite ^/tag/([\s\S]*)$ /index.php?s=index/tag/index&title=$1 last; rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;    rewrite ^/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;    rewrite ^/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;   rewrite ^/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1 last;   rewrite ^/(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1&cw=$3 last; rewrite ^/(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1 last;    rewrite ^/(.*)/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2 last;  rewrite ^/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$2&area=$1 last;  rewrite ^/(.*)/(.*)_(.*)/page/(\d*)$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2&page=$4 last;    rewrite ^/(.*)_(.*)/page/(\d*)$ /index.php?s=index/category/index&ctitle=$2&area=$1&page=$3 last;    rewrite ^/(.*)/$ /index.php?s=index/category/index&ctitle=$1 last;   rewrite ^/(.*)/page/(\d*)$ /index.php?s=index/category/index&ctitle=$1&page=$2 last; rewrite ^/(.*).html$ /index.php?s=index/index/index&area=$1 last;

阿里云增强虚拟主机nginx伪静态配置教程

登录阿里云空间面板-高级环境设置-NGINX设置 复制下面到配置框里即可,只适用于阿里云增强主机nginx环境,其他环境请勿适用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
location / {
    rewrite ^/statics/ueditor/dialogs/(.*)/(.*).html$ /statics/ueditor/dialogs/$1/$2.html break;
    rewrite ^/phpMyAdmin/(.*)$ /phpMyAdmin/$1 last;
    rewrite ^/404.htm$ /index.php?s=index/index/empty404 last;
    rewrite ^/admin/(.*).html$ /index.php?s=admin/$1 last;
    rewrite ^/admin/(.*)$ /index.php?s=admin/$1 last;
    rewrite ^/config/(.*)$ /404.htm last;
    rewrite ^/m/$ /index.php?s=wap/index/index last;
    rewrite ^/m/myform/$ /index.php?s=wap/myform/index last;
    rewrite ^/m/captcha/(\d*)$ /index.php?s=wap/myform/captcha&id=$1 last;
    rewrite ^/m/search/$ /index.php?s=wap/search/index last;
    rewrite ^/m/(.*)_search/$ /index.php?s=wap/search/index&area=$1 last;
    rewrite ^/m/tag/([\s\S]*)$ /index.php?s=wap/tag/index&title=$1 last;
    rewrite ^/m/(.*)_tag/([\s\S]*)$ /index.php?s=wap/tag/index&title=$2&area=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;
    rewrite ^/m/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;
    rewrite ^/m/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;
    rewrite ^/m/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1&cw=$3 last;
    rewrite ^/m/(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2 last;
    rewrite ^/m/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$2&area=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*)/page/(\d*)$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2&page=$4 last;
    rewrite ^/m/(.*)_(.*)/page/(\d*)$ /index.php?s=wap/category/index&ctitle=$2&area=$1&page=$3 last;
    rewrite ^/m/(.*)/$ /index.php?s=wap/category/index&ctitle=$1 last;
    rewrite ^/m/(.*)/page/(\d*)$ /index.php?s=wap/category/index&ctitle=$1&page=$2 last;
    rewrite ^/m/(.*).html$ /index.php?s=wap/index/index&area=$1 last;
    rewrite ^/index(.*)/$ /index.php?s=index/index/index/$1 last;
    rewrite ^/myform/$ /index.php?s=index/myform/index last;
    rewrite ^/(.*)_myform/$ /index.php?s=index/myform/index&area=$1 last;
    rewrite ^/captcha/(\d*)$ /index.php?s=index/myform/captcha&id=$1 last;
    rewrite ^/(.*)_captcha/(\d*)$ /index.php?s=index/myform/captcha&area=$1&id=$2 last;
    rewrite ^/search/$ /index.php?s=index/search/index last;
    rewrite ^/search/page/(\d*)$ /index.php?s=index/search/index&page=$1 last;
    rewrite ^/search/key/(.*)/page/(\d*)$ /index.php?s=index/search/index&key=$1&page=$2 last;
    rewrite ^/(.*)_search/$ /index.php?s=index/search/index&area=$1 last;
    rewrite ^/(.*)_search/page/(\d*)$ /index.php?s=index/search/index&area=$1&page=$2 last;
    rewrite ^/(.*)_search/key/(.*)/page/(\d*)$ /index.php?s=index/search/index&area=$1&key=$2&page=$3 last;
    rewrite ^/(.*)_tag/([\s\S]*)/page/(\d*)$ /index.php?s=index/tag/index&title=$2&area=$1&page=$3 last;
    rewrite ^/(.*)_tag/([\s\S]*)$ /index.php?s=index/tag/index&title=$2&area=$1 last;
    rewrite ^/tag/([\s\S]*)/page/(\d*)$ /index.php?s=index/tag/index&title=$1&page=$2 last;
    rewrite ^/tag/([\s\S]*)$ /index.php?s=index/tag/index&title=$1 last;
    rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;
    rewrite ^/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;
    rewrite ^/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;
    rewrite ^/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1 last;
    rewrite ^/(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1&cw=$3 last;
    rewrite ^/(.*)/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2 last;
    rewrite ^/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$2&area=$1 last;
    rewrite ^/(.*)/(.*)_(.*)/page/(\d*)$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2&page=$4 last;
    rewrite ^/(.*)_(.*)/page/(\d*)$ /index.php?s=index/category/index&ctitle=$2&area=$1&page=$3 last;
    rewrite ^/(.*)/$ /index.php?s=index/category/index&ctitle=$1 last;
    rewrite ^/(.*)/page/(\d*)$ /index.php?s=index/category/index&ctitle=$1&page=$2 last;
    rewrite ^/index.html$ /index.php?s=index/index/index last;
    rewrite ^/(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1 last;
    rewrite ^/(.*).html$ /index.php?s=index/index/index&area=$1 last;
}
 
location ~ /\.ht {
    deny all;
}


Tag: 如何
在线咨询 拨打电话

电话

13363039260

微信二维码

微信二维码