苹果CMS指南

苹果CMSV10伪静态规则分享

2024-08-21 共人阅读

苹果CMS V10支持多种服务器环境下的伪静态配置。开启伪静态后,可以将网站原本较长的动态URL转换为更加简洁的地址形式,有利于网站URL结构统一,也方便用户访问和搜索引擎抓取。

本文整理苹果CMS V10常见的伪静态规则,包含 .htaccess、httpd.ini、maccms.conf 和 web.config 等不同环境下的配置文件,可根据服务器所使用的Web服务器类型选择对应规则。

苹果CMSV10伪静态规则

苹果CMS V10伪静态URL规则对照表

以下为苹果CMS V10常见页面对应的伪静态URL结构。部分URL中的参数名称可以根据实际网站需求进行调整,但修改后需要确保程序中的URL生成规则与服务器Rewrite规则保持一致。

页面类型伪静态规则
视频地图页map
视频分类页type/{id}-{pg}
视频内容页detail/{id}
视频播放页play/{id}-{src}-{num}
视频下载页down/{id}-{src}-{num}
视频筛选页vod-list-id-{id}-pg-{pg}-order-{order}-by-{by}-class-{class}-year-{year}-letter-{letter}-area-{area}-lang-{lang}
视频专题首页topicindex
视频专题列表页topiclist/{id}-{pg}
视频搜索页search-pg-{pg}-wd-{wd}
文章首页artindex
文章分类页artlist/{id}-{pg}
文章内容页art/{id}-{pg}
文章地图页artmap
留言本gbook/{pg}
自定义页面label/{label}
RSSrss/{method}/{pg}

httpd.ini伪静态规则

httpd.ini主要用于支持ISAPI_Rewrite的Windows服务器环境。将以下规则保存为对应的配置文件后,根据服务器环境完成加载。

[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32

RewriteRule ^type/(.*)-(.*)$ /index.php?m=vod-type-id-$1-pg-$2 [I]
RewriteRule ^detail/(.*)$ /index.php?m=vod-detail-id-$1 [I]
RewriteRule ^play/(.*)-(.*)-(.*)$ /index.php?m=vod-play-id-$1-src-$2-num-$3 [I]
RewriteRule ^down/(.*)-(.*)-(.*)$ /index.php?m=vod-down-id-$1-src-$2-num-$3 [I]
RewriteRule ^topiclist/(.*)-(.*)$ /index.php?m=vod-topic-id-$1-pg-$2 [I]
RewriteRule ^topicindex(.*)$ /index.php?m=vod-topicindex-pg-$1 [I]
RewriteRule ^artindex(.*)$ /index.php?m=art-index-pg-$1 [I]
RewriteRule ^artlist/(.*)-(.*)$ /index.php?m=art-type-id-$1-pg-$2 [I]
RewriteRule ^art/(.*)-(.*)$ /index.php?m=art-detail-id-$1-pg-$2 [I]
RewriteRule ^label/(.*)$ /index.php?m=label-$1 [I]
RewriteRule ^map(.*)$ /index.php?m=vod-map$1 [I]
RewriteRule ^artmap(.*)$ /index.php?m=art-map$1 [I]
RewriteRule ^gbook/(.*)$ /index.php?m=gbook-show-pg-$1 [I]
RewriteRule ^search-pg-(.*)-wd-(.*)$ /index.php?m=vod-search-pg-$1-wd-$2 [I]
RewriteRule ^rss/(.*)/(.*)$ /index.php?m=map-$1 [I]
RewriteRule ^vod-list-id-(.*)-pg-(.*)-order-(.*)-by-(.*)-class-(.*)-year-(.*)-letter-(.*)-area-(.*)-lang-(.*)$ /index.php?m=vod-list-id-$1-pg-$2-wd-$3-area-$4-lang-$5-year-$6-letter-$7-order-$8-by-$9 [I]

.htaccess伪静态规则

Apache服务器通常使用 .htaccess 配置伪静态规则。如果苹果CMS安装在网站根目录,一般可以直接使用根目录配置;如果安装在子目录,则需要根据实际安装路径调整 RewriteBase 和相关规则。

# 开启 RewriteEngine
RewriteEngine On

# 如果程序安装在子目录,请根据实际目录修改 RewriteBase
# 根目录安装通常使用 /
RewriteBase /

# 苹果CMS系统规则
RewriteRule ^type/(.*)-(.*)$ index.php?m=vod-type-id-$1-pg-$2
RewriteRule ^detail/(.*)$ index.php?m=vod-detail-id-$1
RewriteRule ^play/(.*)-(.*)-(.*)$ index.php?m=vod-play-id-$1-src-$2-num-$3
RewriteRule ^down/(.*)-(.*)-(.*)$ index.php?m=vod-down-id-$1-src-$2-num-$3
RewriteRule ^topiclist/(.*)-(.*)$ index.php?m=vod-topic-id-$1-pg-$2
RewriteRule ^topicindex(.*)$ index.php?m=vod-topicindex-pg-$1
RewriteRule ^artindex(.*)$ index.php?m=art-index-pg-$1
RewriteRule ^artlist/(.*)-(.*)$ index.php?m=art-type-id-$1-pg-$2
RewriteRule ^art/(.*)-(.*)$ index.php?m=art-detail-id-$1-pg-$2
RewriteRule ^label/(.*)$ index.php?m=label-$1
RewriteRule ^map(.*)$ index.php?m=vod-map$1
RewriteRule ^artmap(.*)$ index.php?m=art-map$1
RewriteRule ^gbook/(.*)$ index.php?m=gbook-show-pg-$1
RewriteRule ^search-pg-(.*)-wd-(.*)$ index.php?m=vod-search-pg-$1-wd-$2
RewriteRule ^rss/(.*)/(.*)$ index.php?m=map-$1
RewriteRule ^vod-list-id-(.*)-pg-(.*)-order-(.*)-by-(.*)-class-(.*)-year-(.*)-letter-(.*)-area-(.*)-lang-(.*)$ index.php?m=vod-list-id-$1-pg-$2-wd-$3-area-$4-lang-$5-year-$6-letter-$7-order-$8-by-$9

maccms.conf伪静态规则

maccms.conf主要用于Nginx等服务器环境。苹果CMS安装在网站根目录和子目录时,对应的路径配置有所不同,需要根据实际安装目录进行调整。

# 安装目录:
# 1、根目录:/
# 2、子目录:/maccms8_syb/

rewrite ^/type/(.*)-(.*)$ index.php?m=vod-type-id-$1-pg-$2 break;
rewrite ^/detail/(.*)$ index.php?m=vod-detail-id-$1 break;
rewrite ^/play/(.*)-(.*)-(.*)$ index.php?m=vod-play-id-$1-src-$2-num-$3 break;
rewrite ^/down/(.*)-(.*)-(.*)$ index.php?m=vod-down-id-$1-src-$2-num-$3 break;
rewrite ^/topiclist/(.*)-(.*)$ index.php?m=vod-topic-id-$1-pg-$2 break;
rewrite ^/topicindex(.*)$ index.php?m=vod-topicindex-pg-$1 break;
rewrite ^/artindex(.*)$ index.php?m=art-index-pg-$1 break;
rewrite ^/artlist/(.*)-(.*)$ index.php?m=art-type-id-$1-pg-$2 break;
rewrite ^/art/(.*)-(.*)$ index.php?m=art-detail-id-$1-pg-$2 break;
rewrite ^/label/(.*)$ index.php?m=label-$1 break;
rewrite ^/map(.*)$ index.php?m=vod-map$1 break;
rewrite ^/artmap(.*)$ index.php?m=art-map$1 break;
rewrite ^/gbook/(.*)$ index.php?m=gbook-show-pg-$1 break;
rewrite ^/search-pg-(.*)-wd-(.*)$ index.php?m=vod-search-pg-$1-wd-$2 break;
rewrite ^/rss/(.*)/(.*)$ index.php?m=map-$1 break;
rewrite ^/vod-list-id-(.*)-pg-(.*)-order-(.*)-by-(.*)-class-(.*)-year-(.*)-letter-(.*)-area-(.*)-lang-(.*)$ index.php?m=vod-list-id-$1-pg-$2-wd-$3-area-$4-lang-$5-year-$6-letter-$7-order-$8-by-$9 break;

web.config伪静态规则

web.config主要用于Windows IIS服务器环境。使用时需要确保服务器已经安装并启用了URL Rewrite模块,然后将对应规则配置到网站的 web.config 文件中。

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>

                <rule name="Imported Rule vodtype">
                    <match url="^type/(.*)-(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-type-id-{R:1}-pg-{R:2}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule voddetail">
                    <match url="^detail/(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-detail-id-{R:1}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule vodplay">
                    <match url="^play/(.*)-(.*)-(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-play-id-{R:1}-src-{R:2}-num-{R:3}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule voddown">
                    <match url="^down/(.*)-(.*)-(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-down-id-{R:1}-src-{R:2}-num-{R:3}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule vodsearch">
                    <match url="^search-pg-(.*)-wd-(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-search-pg-{R:1}-wd-{R:2}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule vodmap">
                    <match url="^map(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-map{R:1}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule shaixuan">
                    <match url="^vod-list-id-(.*)-pg-(.*)-order-(.*)-by-(.*)-class-(.*)-year-(.*)-letter-(.*)-area-(.*)-lang-(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-list-id-{R:1}-pg-{R:2}-wd-{R:3}-area-{R:4}-lang-{R:5}-year-{R:6}-letter-{R:7}-order-{R:8}-by-{R:9}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule ztlist">
                    <match url="^topiclist/(.*)-(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-topic-id-{R:1}-pg-{R:2}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule topic">
                    <match url="^topicindex(.*)$" />
                    <action type="Rewrite" url="index.php?m=vod-topicindex-pg-{R:1}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule artindex">
                    <match url="^artindex(.*)$" />
                    <action type="Rewrite" url="index.php?m=art-index-pg-{R:1}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule arttype">
                    <match url="^artlist/(.*)-(.*)$" />
                    <action type="Rewrite" url="index.php?m=art-type-id-{R:1}-pg-{R:2}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule artdetail">
                    <match url="^art/(.*)-(.*)$" />
                    <action type="Rewrite" url="index.php?m=art-detail-id-{R:1}-pg-{R:2}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule gbook">
                    <match url="^gbook/(.*)$" />
                    <action type="Rewrite" url="index.php?m=gbook-show-pg-{R:1}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule label">
                    <match url="^label/(.*)$" />
                    <action type="Rewrite" url="index.php?m=label-{R:1}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule artmap">
                    <match url="^artmap(.*)$" />
                    <action type="Rewrite" url="index.php?m=art-map{R:1}" appendQueryString="false" />
                </rule>

                <rule name="Imported Rule rss">
                    <match url="^rss/(.*)/(.*)$" />
                    <action type="Rewrite" url="index.php?m=map{R:1}" appendQueryString="false" />
                </rule>

            </rules>
        </rewrite>
    </system.webServer>
</configuration>

苹果CMS V10伪静态配置注意事项

  • 选择对应规则:不同Web服务器使用的伪静态配置文件不同,请根据Apache、IIS、Nginx等实际运行环境选择。

  • 确认安装目录:如果苹果CMS安装在子目录中,需要根据实际目录调整RewriteBase或相关路径。

  • 后台URL设置:启用伪静态后,应检查苹果CMS后台的网站URL及伪静态相关设置是否与服务器规则保持一致。

  • 清理缓存:修改URL规则后建议清理程序缓存,再测试首页、分类页、详情页、播放页和搜索页等主要页面。

  • 避免规则冲突:如果服务器中已经存在其他Rewrite规则,应检查规则顺序,避免与苹果CMS规则发生冲突。

  • 修改前做好备份:调整伪静态配置前建议备份原有配置文件,出现404或500错误时可以快速恢复。

如何测试伪静态是否生效?

配置完成后,可以依次访问网站首页、视频分类页、视频详情页、搜索页和文章页面进行测试。如果页面能够正常访问,并且URL已经按照预期转换为伪静态地址,通常说明Rewrite规则已经正常工作。

如果出现404、500或页面无法正常加载的情况,应重点检查服务器是否启用了Rewrite功能、规则文件位置是否正确、网站安装目录是否匹配,以及当前苹果CMS版本所生成的URL结构是否与服务器规则一致。