ClassCMS伪静态规则

    ClassCMS伪静态规则与常见程序(wordpress,thinkphp等)伪静态规则通用,如服务器已经有这些程序的伪静态规则,可以直接使用.

    如需要手动开关伪静态,则请修改入口文件(默认为index.php)内$GLOBALS['C']['UrlRewrite'] 项,关闭伪静态后,后台地址将更改为 /index.php/xxxxxx (xxxxxx为后台目录,可在入口文件中查看)

    Apache伪静态(.htaccess文件,系统自带此伪静态文件,无需配置,支持子目录伪静态):

    <IfModule mod_rewrite.c>
      Options +FollowSymlinks -Multiviews
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
    </IfModule>

    Nginx伪静态(如不使用伪静态,则需开启pathinfo才能安装):

    location /
    {
         try_files $uri $uri/ /index.php?$args;
    }

    或者

    location /{
        if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php/$1  last;
           break;
        }
    }

    Nginx子目录伪静态:

    location /test/ {
        if (!-e $request_filename) {
            rewrite . /test/index.php last;
        }
    }

    IIS伪静态(web.config)

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

    IIS子目录伪静态(web.config存放于网站根目录)

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