苹果CMS V10在iis7.x、apache、nginx等环境下的伪静态教程

时间:2024-04-09 15:33:41

苹果CMSV10采用了Thinkphp为框架开发,技术积累成熟,问题更新修复速度几乎同步于Thinkphp,第一时间发布最新补丁,让零基础的朋友可以快速高效的搭建起一个视频网站,后台拥有丰富的功能组件,可谓是小巧灵活,是广大站长建设个人视频网站的首选程序。

苹果CMS采用Thinkphp架构,内容以动态的形式展现出来,这对于搜索引擎及用户访问体验是非常不好的,现在较多的cms类网站均是html静态展示内容,html静态展示可以有效的增强用户体验及搜索引擎友好性。苹果CMS对于这个问题给出了两种解决方案,一是直接生成html静态文件,二是采用伪静态的形式展现。两种展示方式基本无差别,后者比较消耗服务器资源罢了。

今天我给大家介绍在IIS、Nginx、Apache等常用环境下的伪静态设置方式。
免费模板请到 苹果cms资源网 获取

一、Apache下的伪静态配置

apache作为全球的第一的Web前端引擎,受到许多服务商的青睐,其拥有丰富的api扩充能力,中文译为阿帕奇。苹果cms在这种环境下基本无需手动设置,程序即会在网站根目录下生成一个.htaccess伪静态文件,如果程序没有自动生成,我们只需要将下面的代码保存到网站根目录下.htaccess文件内即可(若文件不存在则需要手动建立,请开启显示隐藏文件,因为默认.后面的内容为扩展名,不予以显示)

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule

后台开启路由模式、开启伪静态即可隐藏视频连接前面的index.php

二、Nginx下的伪静态配置

Nginx是一款高性能的web前端引擎,其由于占用资源少、高并发能力强、反向代理功能卓越而广受青睐。苹果cms在nginx环境下无法自动生成伪静态配置文件,这样我们就需要手动配置了,伪静态代码如下:

location / {
    if (!-e $request_filename) {
        rewrite ^/index.php(.*)$ /index.php?s=$1 last;
        break;
    }
}
部分网站使用上述代码会出现除首页以外其他页面全部404 NO FOUND,则需要使用下列代码:
location / {
if (!-e $request_filename) {
        rewrite ^/index.php(.*)$ /index.php?s=$1 last;
        rewrite ^/admin.php(.*)$ /admin.php?s=$1 last;
        rewrite ^/api.php(.*)$ /api.php?s=$1 last;
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
        }
     }>

三、IIS下的伪静态配置

Windows作为最常见的操作系统,当然也有服务器版本,windows下web前端引擎主要是IIS程序,这个是一个可视化的操作程序,在IIS下配置伪静态规则比较复杂。

打开IIS的网站管理,选择需要设置伪静态规则的网站,打开URL重写功能,将伪静态啊规则粘贴在里面即可。苹果CMS V10在iis7.x、apache、nginx等环境下的伪静态教程

IIS 6专用伪静态规则:

[ISAPI_Rewrite]
#3600 = 1 hour

CacheClockRate 3600
RepeatLimit 32

RewriteRule (.*)$ /index\.php\?s=$1 [I]
IIS 7专用伪静态规则:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
        <rules>
         <rule name="OrgPage" stopProcessing="true">
         <match url="^(.*)$" />
         <conditions logicalGrouping="MatchAll">
         <add input="{HTTP_HOST}" pattern="^(.*)$" />
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
         </conditions>
         <action type="Rewrite" url="index.php/{R:1}" />
         </rule>
         </rules>
    </rewrite>
    </system.webServer>
</configuration>

四、苹果CMS后台开启伪静态

最后一步操作,只需要在苹果cms后台,系统--->URL地址设置--->路由伪静态设置,中开启对应功能即可。苹果CMS V10在iis7.x、apache、nginx等环境下的伪静态教程

如果你想自定义苹果cms的路由规则就大胆的去修改DIY吧,如果出错的话可以使用下面的规则复原:

map   => map/index
rss   => rss/index

 

index-<page?>   => index/index

gbook-<page?>   => gbook/index
gbook$   => gbook/index

topic-<page?>   => topic/index
topic$  => topic/index
topicdetail-<id>   => topic/detail

actor-<page?>   => actor/index
actor$ => actor/index
actordetail-<id>   => actor/detail
actorshow/<area?>-<blood?>-<by?>-<letter?>-<level?>-<order?>-<page?>-<sex?>-<starsign?>   => actor/show

role-<page?>   => role/index
role$ => role/index
roledetail-<id>   => role/detail
roleshow/<by?>-<letter?>-<level?>-<order?>-<page?>-<rid?>   => role/show

vodtype/<id>-<page?>   => vod/type
vodtype/<id>   => vod/type
voddetail/<id>   => vod/detail
vodrss-<id>   => vod/rss
vodplay/<id>-<sid>-<nid>   => vod/play
voddown/<id>-<sid>-<nid>   => vod/down
vodshow/<id>-<area?>-<by?>-<class?>-<lang?>-<letter?>-<level?>-<order?>-<page?>-<state?>-<tag?>-<year?>   => vod/show
vodsearch/<wd?>-<actor?>-<area?>-<by?>-<class?>-<director?>-<lang?>-<letter?>-<level?>-<order?>-<page?>-<state?>-<tag?>-<year?>   => vod/search

arttype/<id>-<page?>   => art/type
arttype/<id>   => art/type
artshow-<id>   => art/show
artdetail-<id>-<page?>   => art/detail
artdetail-<id>   => art/detail
artrss-<id>-<page>   => art/rss
artshow/<id>-<by?>-<class?>-<level?>-<letter?>-<order?>-<page?>-<tag?>   => art/show
artsearch/<wd?>-<by?>-<class?>-<level?>-<letter?>-<order?>-<page?>-<tag?>   => art/search

label-<file> => label/index