我爱帮助网-手册QQ交流群

Nas交流与矿渣群(unraid 群晖 猫盘 蜗牛等):580680114         物联网/智能家居群:518812757             帮助教程:手册大全

软件使用与建站群:1057308983      虚拟化交流群:13448651

0

蝉知(ChanZhi)与米拓(MetInfo)如何共存在同一个网站中

蝉知(ChanZhi)与米拓(MetInfo)如何共存在同一个网站中


来源:我爱帮助网

作者:tmtony


  整合的目的


         蝉知在建站方面有非常多的优点,特别是文章生成的HTML格式、干净的伪静态处理、 强大的手册功能、统一的移动端界面以及SEO都做得不错,但因为这个建站系统发布还不太久,也还有一些不足,但官方的开发能力和售后都做得非常不错,本想将原来的米拓系统转移到蝉知上面,但考虑到旧网站已经在百度和其它搜索引擎上已经有好几年的收录,怕转移后丢失流量,所以保险一点,还是想通过蝉知与米拓并存的方式来实现2者的整合。


   第一步:对比2个系统的程序目录和文件

1.双方都存在同样的 目录名 data,但2者下面的子目录和文件名并没有冲突

2.双方都存在同名的以下文件:

   1)favicon.ico 

         重复的图标,保留其中一个即可

   2)http.ini    

         如果使用IIS都改名,将内容合并到IIS的web.config中,如果用Linux的apache,可以合并在http.ini中

   3)index.php 

         由于米拓的伪静态不太好设置,所以将蝉知 的Index.php改为Indexcz.php ,然后修改蝉知的伪静态规则

   4)robots 

         蝉知未设置内容,以米拓为准


   第二步:将蝉知的程序目录和文件复制过去,并进行安装

1.先记得按照第一点进行同名文件的处理(先临时将米拓的index.php改名,以便于蝉知的安装)

2.数据库可以与米拓放在同一个数据库中,因为前缀不同,双方并不影响,放在同一个数据库主要是方便将来备份和管理

3.由于我使用了护卫神的主机系统,主机默认目录是web, 与蝉知的www有冲突 ,所以我把system目录直接剪切到web子目录下。(蝉知的目录如果不是www, 则无法访问它的上级目录system)

4.为安全起见,将蝉知admin.php 改为你需要的文件名,如  myself.php

5.运行install.php 进行安装,安装的步骤与官方的一样


   第三步:按照第一步的说明修改Index.php文件名及 伪静态文件

1.将蝉知的index.php 改为 indexcz.php

2.将蝉知伪静态文件中的index.php 替换为 indexcz.php

3.将米拓与蝉知的伪静态内容合并到一个文件中(http.ini 或 web.config)

    注意将 蝉知的伪静态规则 放在最后

    由于米拓与蝉知的伪静态规则有些不同,所以2者并不会有冲突。2者能够很好地共存。

  

    合并完成后的伪静态规则如下(IIS的web.config,  apache的规则则更简单,直接将http.ini 2者合并即可)


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="rule1" stopProcessing="true">
<match url="^index-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="index.php?lang={R:1}&amp;pseudo_jump=1" />
</rule>
<rule name="rule2" stopProcessing="true">
<match url="^([a-zA-Z0-9_\u4e00-\u9fa5]+)/list-([a-zA-Z0-9_\u4e00-\u9fa5]+)-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="{R:1}/index.php?lang={R:3}&amp;metid={R:2}&amp;list=1&amp;pseudo_jump=1" />
</rule>
<rule name="rule3" stopProcessing="true">
<match url="^([a-zA-Z0-9_\u4e00-\u9fa5]+)/list-([a-zA-Z0-9_\u4e00-\u9fa5]+)-([0-9_]+)-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="{R:1}/index.php?lang={R:4}&amp;metid={R:2}&amp;list=1&amp;page={R:3}&amp;pseudo_jump=1" />
</rule>
<rule name="rule4" stopProcessing="true">
<match url="^([a-zA-Z0-9_\u4e00-\u9fa5]+)/jobcv-([a-zA-Z0-9_\u4e00-\u9fa5]+)-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="{R:1}/cv.php?lang={R:3}&amp;selectedjob={R:2}&amp;pseudo_jump=1" />
</rule>
<rule name="rule5" stopProcessing="true">
<match url="^([a-zA-Z0-9_\u4e00-\u9fa5]+)/product-list-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="{R:1}/product.php?lang={R:2}&amp;pseudo_jump=1" />
</rule>
<rule name="rule6" stopProcessing="true">
<match url="^([a-zA-Z0-9_\u4e00-\u9fa5]+)/img-list-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="{R:1}/img.php?lang={R:2}&amp;pseudo_jump=1" />
</rule>
<rule name="rule7" stopProcessing="true">
<match url="^([a-zA-Z0-9_\u4e00-\u9fa5]+)/([a-zA-Z0-9_\u4e00-\u9fa5]+)-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="{R:1}/index.php?lang={R:3}&amp;metid={R:2}&amp;pseudo_jump=1" />
</rule>
<rule name="rule8" stopProcessing="true">
<match url="^tag/([\s\S]+)-([a-zA-Z0-9_\u4e00-\u9fa5]+)" />
<action type="Rewrite" url="search/search.php?class1=&amp;class2=&amp;class3=&amp;searchtype=0&amp;searchword={R:1}&amp;lang={R:2}" />
</rule>
<rule name="ChanZhi1" stopProcessing="true">
  <match url=".*\.(?:gif|jpg|png|css|js|txt|jpeg|swf|flv|ttf|woff).*" />
  <action type="Rewrite" url="{R:0}" />
</rule>
<rule name="ChanZhi2">
  <match url="/httpd(?:\.ini|\.parse\.errors)" />
  <action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="ChanZhi3" stopProcessing="true">
  <match url="^(?!/indexcz.php)(?!/myself.php)(.*)$" ignoreCase="false" />
  <conditions logicalGrouping="MatchAll">
       <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
       <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  </conditions>
  <action type="Rewrite" url="/indexcz.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>



   第四步:注意事项

1.注意 如果使用了蝉知的 栏目别名 要尽量与米拓已有栏目的目录名区分开

   米拓的栏目名称是对应的具体的实际目录名称(每增加一个栏目,就创建一个对应的目录,并把几个PHP文件复制到这个目录下)。而蝉知的别名是虚拟的目录(用伪静态转换的,这样网站的目录结构更简洁,也更方便于移植和将来修改栏目名)

    

   如 米拓的 新闻文章 一般使用 news  (这个子目录是真实存在的)

   如 蝉知的 新闻文章 一般使用 article (这个子目录是虚拟的,通过伪静态转换)

        如  http://www.access-cn.com/article/1.html


2.如果将蝉知作为网站的主页,就要在后台的导航中添加一下米拓相关的栏目的对应链接

    反之,就要在米拓的后台的导航中添加蝉知的相关栏目的链接



这样就大功告成了!


   后记:

尝试将蝉知与Discuz论坛整合

但发现 2者 有些目录有同名且内容会有重叠

有同名Data 目录 (虽有重复叠,但还是可以处理)

有同名Template目录(这个目录不太好处理)


等有时间再来尝试一下,再分享给大家。

有关蝉知的纯源创技巧,如果大家觉得好,就点个赞


补充:

今天发现 produc 产品这个 大家还是有冲突 ,解决办法

1.修改metinfo的 product 文件目录为 prod (要将安全狗先停掉才能修改)

2.将表中(栏目表)中的product 全部改为prod

3.修改web.config 在最前面添加以下内容

 <!--- must place first -->
<rule name="rule21" stopProcessing="true"> 
<match url="^(product|prod)/list-([a-zA-Z0-9_\u4e00-\u9fa5]+)-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="prod/index.php?lang={R:3}&amp;metid={R:2}&amp;list=1&amp;pseudo_jump=1" />
</rule>

<rule name="rule71" stopProcessing="true">
<match url="^(product|prod)/([a-zA-Z0-9_\u4e00-\u9fa5]+)-([a-zA-Z0-9_\u4e00-\u9fa5]+).html" />
<action type="Rewrite" url="prod/index.php?lang={R:3}&amp;metid={R:2}&amp;pseudo_jump=1" />
</rule>

<rule name="rule72" stopProcessing="true">
<match url="^(product)/showproduct.php?([a-zA-Z0-9_\u4e00-\u9fa5]+)" />
<action type="Rewrite" url="prod/showproduct.php?{R:2}" />
</rule>
 

 


不知道将来这个会不会受到影响 米拓的升级,可能有些升级要手工调整下