首页>飞飞CMS教程>飞飞CMS自定义伪静态规则教程(附nginx写法)

飞飞CMS自定义伪静态规则教程(附nginx写法)

小编兔妹 2024-10-12 飞飞CMS教程 45 浏览

ffcms 的伪静态规则支持自定义,空间较小的站长也能拥有和静态页面一样的浏览网址;本篇附 nginx 写法。

ffcms自定义伪静态功能,针对空间较小的站长来说。可以轻松实现和静态页面一样的浏览网址。假如你的服务器要么虚拟空间是linux系统,apache服务器,可以选择apache重写规则。在网站根文件夹找到.htaccess,使用记事本开启替换信息就能实现伪静态。若是nginx服务器,则选择相应的规则。

首先列出每个页面的真实浏览网址:

视频栏目页 index.php?s=/Home-vod-show-id-*-p-*-wd-*-area-*-language-*-actor-*-director-*-year-*-letter-*-order-*.html
视频内容页 index.php?s=/Home-vod-read-id-*.html
视频播放页 index.php?s=/Home-vod-play-id-*-sid-*-pid-*.html
视频搜索页 index.php?s=/Home-vod-search-wd-*-p-*-area-*-language-*-actor-*-director-*-year-*-letter-*-order-*.html
视频tag页 index.php?s=/Home-tag-show-wd-*-p-*.html</code>
新闻栏目页index.php?s=/Home-news-show-id-*-p-*.html
新闻内容页index.php?s=/Home-news-read-id-*.html
新闻搜索页index.php?s=/Home-news-search-wd-*-p-*.html
新闻tag页index.php?s=/Home-tag-shown-wd-*-p-*.html
专题列表页index.php?s=/Home-special-show-p-*.html
专题内容页index.php?s=/Home-special-read-id-*.html
留言本index.php?s=/Home-gb-show-p-*-id-*.html
地图页index.php?s=/Home-map-show-id-*-limit-*.html
自定义模板index.php?s=/Home-my-show-id-*.html
prepreprepreprepreprepreprepreprepreprepre

重写例子(后缀名设为html)

视频栏目页规则:/video/$id-$page
视频内容页规则:/video/$id
视频播放页规则:/video/$id-$sid-$pid
视频搜索页规则:/search/$wd-$page
视频TAG页规则:/tag/$wd-$page
自定义模板规则:/detail/$i
prepreprepreprepreprepreprepreprepreprepre

重写规则(apache 其它web服务器请借鉴)

RewriteRule ^video/([0-9]+).html$ index.php?s=/Home-vod-read-id-$1
RewriteRule ^video/([0-9]+)-([0-9]+).html$ index.php?s=/Home-vod-show-id-$1-p-$2
RewriteRule ^video/([0-9]+)-([0-9]+)-([0-9]+).html$ index.php?s=/Home-vod-play-id-$1-sid-$2-pid-$3
RewriteRule ^search/(.*)-([0-9]+).html$ index.php?s=/Home-vod-search-wd-$1-p-$2
RewriteRule ^tag/(.*)-([0-9]+).html$ index.php?s=/Home-tag-show-wd-$1-p-$2
RewriteRule ^detail/(.*).html$ index.php?s=/Home-my-show-id-$1
prepreprepreprepreprepreprepreprepreprepre

重写规则(nginx)

rewrite ^/video/([0-9]+).html$ index.php?s=/Home-vod-read-id-$1;
prepreprepreprepreprepreprepreprepreprepre


伪静态规则改完后记得重启或重载 nginx,再回前台验证一下栏目页和详情页的网址形态是否符合预期。