苹果CMSV10最新伪静态设置方法

苹果CMSV10最新伪静态设置方法

2019011811091514.png

我重新建了一个影视站,为了未来发展,对网站进行了一系列的优化,最后却在伪静态那里出了问题,因为之前没有怎么认真做影视站,所以不是很了解苹果cms v10的伪静态规则,后来在网上看到了一篇教程,才搞好的,但是那个伪静态规则还是有点瑕疵的,于是我对其进行了二次开发,终于把伪静态搞好了。
伪静态是相对真实静态来讲的,通常我们为了增强搜索引擎的友好面,都将文章内容生成静态页面,但是有的朋友为了实时的显示一些信息。或者还想运用动态脚本解决一些问题。不能用静态的方式来展示网站内容。但是这就损失了对搜索引擎的友好面。怎么样在两者之间找个中间方法呢,这就产生了伪静态技术。就是展示出来的是以html一类的静态页面形式,但其实是用动态脚本来处理的。
苹果CMS是国内优秀的开源PHP建站系统,擅长电影程序影视系统这一块,在主流建站系统中特色鲜明,以灵活、小巧、兼容性好、负载强等优点而深受许多站长的喜爱。拥有多年积累,技术先进,功能全面,性能优良,零门槛开箱即用的建站解决方案

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

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

今天自然给大家介绍在IIS、Nginx、Apache等常用环境下的伪静态设置方式。
一、Apache下的伪静态配置
apache作为全球的第一的Web前端引擎,受到许多服务商的青睐,其拥有丰富的api扩充能力,中文译为阿帕奇。苹果cms在这种环境下基本无需手动设置,程序即会在网站根目录下生成一个.htaccess伪静态文件,如果程序没有自动生成,我们只需要将下面的代码保存到网站根目录下.htaccess文件内即可
(若文件不存在则需要手动建立,请开启显示隐藏文件,因为默认.后面的内容为扩展名,不予以显示)
  1. <IfModule mod_rewrite.c>
  2. Options +FollowSymlinks -Multiviews
  3. RewriteEngine on
  4.  
  5. RewriteCond %{REQUEST_FILENAME} !-d
  6. RewriteCond %{REQUEST_FILENAME} !-f
  7. RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
  8. </IfModule>

     

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

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

 
  1. location / {
  2.     if (!-e $request_filename) {
  3.         rewrite ^/index.php(.*)$ /index.php?s=$1 last;
  4.         break;
  5.     }
  6. }
部分网站使用上述代码会出现除首页以外其他页面全部404 NO FOUND,则需要使用下列代码:
  1. location / {
  2. if (!-e $request_filename) {
  3.         rewrite ^/index.php(.*)$ /index.php?s=$1 last;
  4.         rewrite ^/admin.php(.*)$ /admin.php?s=$1 last;
  5.         rewrite ^/api.php(.*)$ /api.php?s=$1 last;
  6.         rewrite ^(.*)$ /index.php?s=$1 last;
  7.         break;
  8.         }
  9.      }
三、IIS下的伪静态配置

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

打开IIS的网站管理,选择需要设置伪静态规则的网站,打开URL重写功能,将伪静态啊规则粘贴在里面即可。

2019011810525248.png

IIS 6专用伪静态规则:

  1. [ISAPI_Rewrite]
  2. #3600 = 1 hour
  3.  
  4. CacheClockRate 3600
  5. RepeatLimit 32
  6.  
  7. RewriteRule (.*)$ /index\.php\?s=$1 [I]

IIS 7专用伪静态规则:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3.     <system.webServer>
  4.         <rewrite>
  5.         <rules>
  6.          <rule name="OrgPage" stopProcessing="true">
  7.          <match url="^(.*)$" />
  8.          <conditions logicalGrouping="MatchAll">
  9.          <add input="{HTTP_HOST}" pattern="^(.*)$" />
  10.          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  11.          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  12.          </conditions>
  13.          <action type="Rewrite" url="index.php/{R:1}" />
  14.          </rule>
  15.          </rules>
  16.     </rewrite>
  17.     </system.webServer>
  18. </configuration>
四、苹果CMS后台开启伪静态
最后一步操作,只需要在苹果cms后台,系统--->URL地址设置--->路由伪静态设置,中开启对应功能即可。

2019011810593112.png

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

  1. map   => map/index
  2. rss   => rss/index
  3.  
  4. index-<page?>   => index/index
  5.  
  6. gbook-<page?>   => gbook/index
  7. gbook$   => gbook/index
  8.  
  9. topic-<page?>   => topic/index
  10. topic$  => topic/index
  11. topicdetail-<id>   => topic/detail
  12.  
  13. actor-<page?>   => actor/index
  14. actor$ => actor/index
  15. actordetail-<id>   => actor/detail
  16. actorshow/<area?>-<blood?>-<by?>-<letter?>-<level?>-<order?>-<page?>-<sex?>-<starsign?>   => actor/show
  17.  
  18. role-<page?>   => role/index
  19. role$ => role/index
  20. roledetail-<id>   => role/detail
  21. roleshow/<by?>-<letter?>-<level?>-<order?>-<page?>-<rid?>   => role/show
  22.  
  23.  
  24. vodtype/<id>-<page?>   => vod/type
  25. vodtype/<id>   => vod/type
  26. voddetail/<id>   => vod/detail
  27. vodrss-<id>   => vod/rss
  28. vodplay/<id>-<sid>-<nid>   => vod/play
  29. voddown/<id>-<sid>-<nid>   => vod/down
  30. vodshow/<id>-<area?>-<by?>-<class?>-<lang?>-<letter?>-<level?>-<order?>-<page?>-<state?>-<tag?>-<year?>   => vod/show
  31. vodsearch/<wd?>-<actor?>-<area?>-<by?>-<class?>-<director?>-<lang?>-<letter?>-<level?>-<order?>-<page?>-<state?>-<tag?>-<year?>   => vod/search
  32.  
  33.  
  34. arttype/<id>-<page?>   => art/type
  35. arttype/<id>   => art/type
  36. artshow-<id>   => art/show
  37. artdetail-<id>-<page?>   => art/detail
  38. artdetail-<id>   => art/detail
  39. artrss-<id>-<page>   => art/rss
  40. artshow/<id>-<by?>-<class?>-<level?>-<letter?>-<order?>-<page?>-<tag?>   => art/show
  41. artsearch/<wd?>-<by?>-<class?>-<level?>-<letter?>-<order?>-<page?>-<tag?>   => art/search
  42.  
  43. label-<file> => label/index
本文标题:苹果CMSV10最新伪静态设置方法
本文链接:https://www.lengxi.net/post/229.html
作者授权:除特别说明外,本文由 冷曦 原创编译并授权 冷曦博客 - 源码之家 刊载发布。
版权声明:本文不使用任何协议授权,您可以任何形式自由转载或使用。

暂无留言,赶快评论吧

欢迎留言