emlog4.0 5.0伪静态规则【iis / nginx】

2014年09月10日 技术资料 2900 views 0

点击查看原图 emlog4.0 5.0伪静态规则【iis / nginx】 第1张
IIS6:(iis6主机请联系主机商修改规则,部分主机支持httpd.ini,

请将下列代码保存为httpd.ini或者下载附件中的httpd.ini上传到博客根目录)

    [ISAPI_Rewrite]
    # 3600 = 1 hour
    CacheClockRate 3600
    RepeatLimit 32
    RewriteRule /robots.txt(.*) /robots.txt$1 [L]
    RewriteRule /rss.php(.*) /rss.php$1 [L]
    RewriteRule /tb.php(.*) /tb.php$1 [L]
    RewriteRule /favicon.ico /favicon.ico [L]
    RewriteRule /xmlrpc.php(.*) /xmlrpc.php$1 [L] 
    RewriteRule /wlwmanifest.xml /wlwmanifest.xml [L] 
    RewriteRule /(t|m)$ /$1/ [R]
    RewriteRule /(admin|content|include|t|m)/(.*) /$1/$2 [L]
    RewriteRule /install.php(.*) /install.php$1 [L]
    RewriteRule /emlog_toolkit.php(.*) /emlog_toolkit.php$1 [L]
    RewriteRule /up(\d.\d.\d)to(\d.\d.\d).php(.*) /up$1to$2.php$3 [L]
    RewriteRule ^/$ /index.php [L]
    RewriteRule /(.*) /index.php/$1 [L]




支持.htaccess的IIS6服务器规则:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php/$0 [L]







关于IIS6规则说明:

由于IIS6不支持.htaccess的一些判断规则,因此只能事先处理一些会被正常访问的目录或者文件。有些地方可能需要做修改:


1、如果你有其他非emlog文件,因为添加如上规则而不能正常访问,要想使它们能正常访问的,则添加一条规则在第5行后面,参考第五行


RewriteRule /rss.php(.*) /rss.php$1 [L]



将rss.php修改为你要访问的文件即可
如果你有其他非emlog目录,因为添加如上规则而不能正常访问,要想使它们能正常访问的,则参考第10、11行,将目录添加进来(用|隔开目录)


RewriteRule /(t|m|admin)$ /$1/ [R]
RewriteRule /(admin|content|include|t|m)/(.*) /$1/$2 [L]



如果你的博客在子目录,那么需要将所有目录都改为子目录的,比如你的博客在emlog目录下,


那么规则如下:

     [ISAPI_Rewrite]
    # 3600 = 1 hour
    CacheClockRate 3600
    RepeatLimit 32
    RewriteRule /emlog/rss.php(.*) /emlog/rss.php$1 [L]
    RewriteRule /emlog/tb.php(.*) /emlog/tb.php$1 [L]
    RewriteRule /emlog/favicon.ico /emlog/favicon.ico [L]
    RewriteRule /emlog/xmlrpc.php(.*) /emlog/xmlrpc.php$1 [L] 
    RewriteRule /emlog/wlwmanifest.xml /emlog/wlwmanifest.xml [L] 
    RewriteRule /emlog/(t|m)$ /emlog/$1/ [R]
    RewriteRule /emlog/(admin|content|include|t|m)/(.*) /emlog/$1/$2 [L]
    RewriteRule /emlog/install.php(.*) /emlog/install.php$1 [L]
    RewriteRule /emlog/emlog_toolkit.php(.*) /emlog/emlog_toolkit.php$1 [L]
    RewriteRule /emlog/up(\d.\d.\d)to(\d.\d.\d).php(.*) /emlog/up$1to$2.php$3 [L]
    RewriteRule ^/emlog/$ /emlog/index.php [L]
    RewriteRule /emlog/(.*) /emlog/index.php/$1 [L]





nginx:(nginx主机请联系主机商更改规则,部分主机可能支持自定义规则)

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






IIS7/7.5 规则

     <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="emlog 4.0.1 for IIS7.5" stopProcessing="true">
                        <match url="." ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="/index.php" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>





👍好活当赏🧧