同一套xyhcms 行云海CMS程序在同一个空间内一个主站+ 多个二级目录分站设置伪静态
    文章作者:恒爱云[恒爱网络] 阅读次数:44 发布时间:2025-8-15

    某客户使用同一套xyhcms 行云海CMS程序在我司同一个空间内搭建了一个主站+ 多个二级目录分站,设置伪静态后发现二级目录内的分站部分伪静态无法打开。

    接到求助以后研究了很久,发现是主站下的伪静态和3个分站 lixin   zhouliu    guolu 下的伪静态存在冲突导致的。

    为了避免冲突,根目录下的伪静态web.config 里的主站伪静态里要排除  这3个分站的目录 ,以避免伪静态规则冲突 ,具体代码如下: 



    <?xml version="1.0" encoding="UTF-8"?>

    <configuration>
      <location path="." inheritInChildApplications="false">
        <system.webServer>
                        
            <!--start-rewrite-->
            <rewrite>
                <rules>    
                
                    <rule name="Rewrite to index.php" stopProcessing="true">
                        <match url="^(.*)$" />
                                             
                        <conditions logicalGrouping="MatchAll">
                        
                         <add input="{QUERY_STRING}" pattern="^$" ignoreCase="false" /> 
                         <add input="{REQUEST_URI}" pattern="^/(lixin|zhouliu|guolu)" ignoreCase="true" negate="true" /> 
                         
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        </conditions>
                        
                        <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
                    </rule>
                    

                    <rule name="Rewrite to lixin" stopProcessing="true">
                        <match url="^lixin/(.*)$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        </conditions>                   
                        <action type="Rewrite" url="lixin/index.php/{R:1}" appendQueryString="true" />
                    </rule>                
                


                    <rule name="Rewrite to zhouliu" stopProcessing="true">
                        <match url="^zhouliu/(.*)$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        </conditions>                    
                        <action type="Rewrite" url="zhouliu/index.php/{R:1}" appendQueryString="true" />
                    </rule>        



                    <rule name="Rewrite to guolu" stopProcessing="true">
                        <match url="^guolu/(.*)$" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        </conditions>                    
                        <action type="Rewrite" url="guolu/index.php/{R:1}" appendQueryString="true" />
                    </rule>        


                </rules>
            </rewrite>    
            <!--end-rewrite-->    
        </system.webServer>
     </location>
    </configuration>