下载鸥 > 网站下载 > 开发教程 > 帝国CMS

帝国CMS7.5默认伪静态规则大全(.htacces+nginx+web.config)

463 2021-03-18 16:10:31

收藏
帝国CMS7.5默认动态页面伪静态设置,请到后台系统设置 - 伪静态参数里,将需要设置伪静态的选项全部设置为默认。而后,在服务器配置如下规则。

帝国CMS7.5默认伪静态规则大全(.htacces+nginx+web.config)提供了多种服务器的伪静态,供参考。

帝国CMS7.5默认伪静态规则大全(.htacces+nginx+web.config)

.htaccess伪静态规则

RewriteEngine On
ErrorDocument 404 /404.php
Rewritebase /
#信息内容页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^showinfo-([0-9]+)-([0-9]+)-([0-9]+).html$ /e/action/ShowInfo.php?classid=$1&id=$2&page=$3 [NC,L]
#信息列表
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^listinfo-([0-9]+)-([0-9]+).html$ /e/action/ListInfo/index.php?classid=$1&page=$2 [NC,L]
#标题分类列表页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^infotype-([0-9]+)-([0-9]+).html$ /e/action/InfoType/index.php?ttid=$1&page=$2 [NC,L]
#TAGS信息列表页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^tags-(etagid[0-9]+)-([0-9]+).html$ /e/tags/index.php?tagname=$1&page=$2 [NC,L]
#评论列表页
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^comment-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html$  /e/pl/index.php?doaction=$1&classid=$2&id=$3&page=$4&myorder=$5&tempid=$6 [NC,L]
#栏目自定义伪静态 默认添加.html 后缀更多的后缀自行添加
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(d/|e/|html/|images/|s/|search/|skin/|t/|ad/|ebak/|web/|m2/|api)
RewriteRule ^([0-9a-zA-Z-/]+)/(|index.html|index_[0-9]+.html)$ /e/action/list.php?classid=$1&page=$2 [NC,L]
#内容自定义伪静态 默认添加.html 后缀更多的后缀自行添加
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(d/|e/|html/|images/|s/|search/|skin/|t/|ad|ebak/|web/|m2/|api)
RewriteRule ^([0-9a-zA-Z-/]+)/([0-9a-zA-Z]+)([_0-9]*).html$ /e/action/show.php?classid=$1&id=$2&page=$3 [NC,L]

 

Nginx.conf伪静态规则

rewrite ^/showinfo-([0-9]+)-([0-9]+)-([0-9]+).html$ /e/action/ShowInfo.php?classid=$1&id=$2&page=$3 last;
rewrite ^/listinfo-([0-9]+)-([0-9]+).html$ /e/action/ListInfo/index.php?classid=$1&page=$2 last;
rewrite ^/infotype-([0-9]+)-([0-9]+).html$ /e/action/InfoType/index.php?ttid=$1&page=$2 last;
rewrite ^/tags-(etagid[0-9]+)-([0-9]+).html$ /e/tags/index.php?tagname=$1&page=$2 last;
rewrite ^/comment-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-(.+?).html$  /e/pl/index.php?doaction=$1&classid=$2&id=$3&page=$4&myorder=$5&tempid=$6 last;
if (!-f $request_filename){
    set $rule_0 1$rule_0;
}
if ($request_uri !~ "^(/d/|/e/|/html/|/images/|/s/|/search/|/skin/|/t/|/ad/)"){
    set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
    rewrite ^/([0-9a-zA-Z-/]+)/(|index.html|index_[0-9]+.html)$ /e/action/list.php?classid=$1&page=$2 last;
    rewrite ^/([0-9a-zA-Z-/]+)/([0-9a-zA-Z]+)([_0-9]*).html$ /e/action/show.php?classid=$1&id=$2&page=$3 last;
}
if (!-e $request_filename) {
    return 404;
}

 

web.config伪静态规则

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors errorMode="DetailedLocalOnly">
            <remove statusCode="404" />
            <error statusCode="404" path="/404.php" responseMode="ExecuteURL" />
        </httpErrors>
        <rewrite>
            <rules>
                <rule name="规则 1" stopProcessing="true">
                    <match url="^showinfo-([0-9]+)-([0-9]+)-([0-9]+).html$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="/e/action/ShowInfo.php?classid={R:1}&amp;id={R:2}&amp;page={R:3}" appendQueryString="false" />
                </rule>
                <rule name="规则 2" stopProcessing="true">
                    <match url="^listinfo-([0-9]+)-([0-9]+).html$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="/e/action/ListInfo/index.php?classid={R:1}&amp;page={R:2}" appendQueryString="false" />
                </rule>
                <rule name="规则 3" stopProcessing="true">
                    <match url="^infotype-([0-9]+)-([0-9]+).html$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="/e/action/InfoType/index.php?ttid={R:1}&amp;page={R:2}" appendQueryString="false" />
                </rule>
                <rule name="规则 4" stopProcessing="true">
                    <match url="^tags-(etagid[0-9]+)-([0-9]+).html$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="/e/tags/index.php?tagname={R:1}&amp;page={R:2}" appendQueryString="false" />
                </rule>
                <rule name="规则 5" stopProcessing="true">
                    <match url="^comment-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="/e/pl/index.php?doaction={R:1}&amp;classid={R:2}&amp;id={R:3}&amp;page={R:4}&amp;myorder={R:5}&amp;tempid={R:6}" appendQueryString="false" />
                </rule>
                <rule name="规则 6" stopProcessing="true">
                    <match url="^([0-9a-zA-Z-/]+)/(|index.html|index_[0-9]+.html)$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{R:1}" pattern="^(d/|e/|html/|images/|s/|search/|skin/|t/|ad/|ebak/|web/|m2/|api)" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/e/action/list.php?classid={R:1}&amp;page={R:2}" appendQueryString="false" />
                </rule>
                <rule name="规则 7" stopProcessing="true">
                    <match url="^([0-9a-zA-Z-/]+)/([0-9a-zA-Z]+)([_0-9]*).html$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{QUERY_STRING}" pattern="^(.*)$" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{R:1}" pattern="^(d/|e/|html/|images/|s/|search/|skin/|t/|ad|ebak/|web/|m2/|api)" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/e/action/show.php?classid={R:1}&amp;id={R:2}&amp;page={R:3}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
        <httpRedirect enabled="false" />
    </system.webServer>
</configuration>

 

本文地址:https://xzo.com.cn/develop/empire/721.html

有帮助,很赞!

信息来源:下载鸥
导出教程 下载word版教程
发表评论 共有条评论
关于帝国CMS


帝国cms是一款功能极为强大的cms程序,性能强悍、安全性高,可轻松支持10万数据,高级开发人员可制作出能容纳千万数据量的网站,是国内最出色的开源cms程序之一,推荐企业用户使用

当前最新版本为7.5,8.0版本即将上线,新版本的核心优化点在于多终端的适配。

推荐帝国CMS开发教程
宝塔面板帝国cms搬家报错No input file specified
宝塔面板帝国cms搬家报错No input file specified

今天有客户向鸥哥求助说宝塔面板帝国cms搬家报错No input file specified,这...

23 2036
帝国CMS怎样高效快速的做猜你喜欢的随机调用功能?
帝国CMS怎样高效快速的做猜你喜欢的随机调用功能?

猜你喜欢小功能如果直接用rand()调用随机ID是非常消耗性能的。小网站几百几...

7 440
帝国cms怎样默认显示副标题ftitle,副标题为空时显示标题?
帝国cms怎样默认显示副标题ftitle,副标题为空时显示标题?

在帝国cms的开发应用中,标题作为文章的主体往往需要表意明显才能获得更好的...

1 469
帝国cms生成自定义列表页怎样压缩?
帝国cms生成自定义列表页怎样压缩?

帝国cms生成的静态页面,大多是在gethtml()函数下实现代码压缩,但自定义页面、...

0 387
帝国cms怎样去掉面包屑导航里的隐藏栏目
帝国cms怎样去掉面包屑导航里的隐藏栏目

帝国cms有隐藏栏目的功能,但隐藏栏目的文章如果展示,面包屑导航里会带上被隐...

1 600
帝国cms怎样判断文章有没有缩略图?
帝国cms怎样判断文章有没有缩略图?

在帝国cms二次开发过程中,我们有时会需要判断一条信息有没有缩略图(标题图)。...

0 354
帝国CMS怎么整合Discuz
帝国CMS怎么整合Discuz

Discuz是一个相当流行的论坛系统,现在百度站长论坛还是使用的discuz。帝国cm...

0 396
帝国cms判断图片是否带域名,无域名则补全域名
帝国cms判断图片是否带域名,无域名则补全域名

那么,我们要怎样在图片路径不完善的时候正常在手机端显示图片呢?...

0 426
推荐插件
帝国cms批量添加后台用户插件
帝国cms批量添加后台用户插件

使用帝国cms的企业用户、新闻资讯类站点的用户很多,此类站点很多时候需要有...

0 664
帝国cms网站会员登录与退出历史记录日志插件
帝国cms网站会员登录与退出历史记录日志插件

帝国cms默认只有上次登录时间与ip,没有一个记录清单,所以今天,我们分享这个帝...

0 352
帝国cms智能自动审核按星期几审核指定栏目带推送插件
帝国cms智能自动审核按星期几审核指定栏目带推送插件

采集站的必备资源是自动审核,要做到日收录也离不开定时发布。而本插件的自动...

0 1199
帝国cms百度文字识别ocr接口对接插件
帝国cms百度文字识别ocr接口对接插件

许多网站会做一些小功能小插件给客户使用以增强用户黏性,比如图片转文字,这种...

0 412
帝国cms百度AI黑白图像上色api接口对接插件
帝国cms百度AI黑白图像上色api接口对接插件

百度开放了系列AI功能api如图像上色、图像去雾、图像修复、无损放大、清晰...

0 364
帝国cms访问统计ip地址链接与封禁插件下载
帝国cms访问统计ip地址链接与封禁插件下载

下载鸥开发了这款帝国cms封禁ip插件,自动记录访问情况,让我们可以更快的识别...

0 936
帝国cms自动生成文章新闻目录插件下载
帝国cms自动生成文章新闻目录插件下载

用户体验是我们的需求,百度蜘蛛的认可更是我们的需求。毕竟,没有收录排名,何来...

0 1045
帝国cms多栏目多数据表自动审核推送插件
帝国cms多栏目多数据表自动审核推送插件

本插件基于帝国cms帝国cms每日自动审核插件,在自动审核指定条数信息的基础上...

0 850
客服QQ:341553759
扫码咨询 常见问题 >
官方交流群:90432500
点击加入