苹果cms教程

苹果CMS V10全环境伪静态规则配置教程

发布时间:2024-08-28共13人阅读

伪静态是苹果CMS V10影视站点必备的基础配置,可将动态带参数的访问链接转换为简洁规范的静态路径,统一全站URL格式,让视频、文章、搜索、专题等页面链接更规整。不同服务器环境适配的伪静态规则不同,本文汇总各类服务器专属可用规则、URL对应关系、配置步骤及测试排查技巧,适配全站页面访问需求。

苹果CMS伪静态规则

一、苹果CMS V10伪静态核心作用

苹果CMS V10默认链接为动态参数格式,依靠参数识别页面模块,地址杂乱且无统一规范。开启伪静态后,可将动态参数链接重写为简洁的目录式链接,适配全站各类页面访问。

典型伪静态链接示例:

// 视频详情页
detail/123
// 视频播放页
play/123-1-1

规范的URL结构不仅便于站点链接统一管理,同时能优化用户访问体验,需注意伪静态仅为链接格式重写,站点整体访问效果仍取决于页面内容与站点整体质量。

二、全站伪静态URL规则对照表

下表汇总苹果CMS V10全站所有页面的伪静态访问规则,涵盖视频、文章、搜索、专题、自定义页面等核心模块,参数释义:{id}为数据ID、{pg}为分页页码、{src}为播放/下载来源、{num}为视频集数。

页面类型伪静态规则
视频地图页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}

页面前缀type、detail、play等支持自定义修改,修改后必须同步更新服务器伪静态规则,保证程序生成URL与重写规则一致,避免出现404访问异常。

三、多服务器专属伪静态规则

苹果CMS V10针对不同Web服务器配备专属伪静态规则,不可混用,需根据自身服务器环境选择对应配置。

3.1 IIS ISAPI_Rewrite环境(httpd.ini)

该规则适用于搭载ISAPI_Rewrite组件的IIS服务器,将代码保存为httpd.ini放置网站配置目录即可生效。

[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]

3.2 Apache环境(.htaccess)

Apache服务器默认使用根目录.htaccess文件实现伪静态,需开启重写模块并适配网站目录。

# 将 RewriteEngine 模式打开
RewriteEngine On
# 修改以下语句中的 /maccms 为你的网站目录地址,
# 如果程序放在根目录中,请将 /maccms 修改为 /
RewriteBase /
# Rewrite 系统规则请勿修改
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

Apache配置注意事项:必须开启RewriteEngine模块;RewriteBase根据站点安装目录调整,根目录为/,子目录需填写对应路径;服务器需允许目录使用.htaccess文件,修改后清理缓存测试全站页面。

3.3 Nginx环境(maccms.conf)

Nginx伪静态需将规则写入站点conf配置文件,仅上传文件无法生效,修改后需重载配置。

#安装目录
#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;

Nginx配置注意事项:规则需写入当前站点独立配置文件,保存后检测语法无误,重启或重载Nginx服务,确保规则正常加载。

3.4 IIS URL Rewrite环境(web.config)

Windows IIS无ISAPI_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">
<!-- RSS地图页 -->
<match url="^rss/(.*)/(.*)$" />
<action type="Rewrite" url="index.php?m=map{R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

四、伪静态规则适配选择指南

配置伪静态无需上传所有规则文件,严格根据服务器环境一对一选择即可,适配方案如下:

服务器环境规则文件配置位置
Apache.htaccess网站根目录
IIS + ISAPI_Rewritehttpd.ini网站规则配置目录
Nginxmaccms.confNginx站点配置文件
IIS URL Rewriteweb.config网站根目录

五、配置后全站测试方法

规则部署完成后,需逐项测试全站页面,避免局部页面404,测试项目包含:

  • 网站首页正常访问

  • 视频分类、详情、播放、下载页面访问正常

  • 视频多页分页、筛选页面无异常

  • 搜索页面可正常提交关键词并跳转

  • 专题、文章、留言本、自定义页面正常打开

  • 网站地图、RSS功能访问正常

若首页正常、内页404,多为规则未生效、目录配置错误或URL格式不匹配导致。

六、常见故障排查方案

1、全站页面404

优先排查服务器是否开启Rewrite重写功能,核对规则文件放置位置,确认规则与服务器环境匹配,禁止多套规则混用。

2、子目录安装站点伪静态失效

站点安装在子目录时,需针对性修改配置:Apache修改RewriteBase目录路径,Nginx调整规则前缀路径,不可直接套用根目录规则。

3、仅播放页无法访问

播放页URL包含三段参数,是最易出错的页面,需核对播放页专属重写规则是否完整,确保模板生成的URL参数格式与服务器重写规则完全对应。

4、修改规则后无效果

清理浏览器缓存、站点缓存,重载服务器配置,确认修改后的规则已成功覆盖旧配置。常规正版模板无需二次修改,保持程序URL生成规则与服务器规则统一即可。

七、配置总结

苹果CMS V10伪静态配置的核心是环境匹配、目录适配、URL统一,不同服务器对应专属规则文件,切勿混用套用。配置前确认站点安装目录,部署完成后务必测试全站所有页面及分页功能,规避404、参数丢失等问题。更换服务器前建议备份原有伪静态配置,保证站点链接格式稳定统一。