EMLOG不同服务器环境下的伪静态规则分享

EMLOG默认的网址规则为静态页面,但EMLOG也支持静态页面和伪静态页面,只不过生成静态页面需要插件的支持,而伪静态则是介于静态和动态之间的折中的做法。

相对来说,静态页面虽然更利于SEO优化,但这样的做法会在网站目录下生成静态页面,对于在代码上有洁癖的用户来说并不适用,因此我们可以SEO效果同样较好的伪静态使得网站变得对搜索引擎更加友好。

那么,现在就来为大家分享一下EMLOG在各种服务器环境下的伪静态规则,帮助大家更好的建设好自己的EMLOG网站。

一、支持httpd.ini的IIS6服务器环境的规则

[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]

1、如果你的网站存放于根目录下的子目录,比如emlog目录,则需要使用以下规则

[ISAPI_Rewrite]# 3600 = 1
hourCacheClockRate 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]

二、支持.htaccess的IIS6服务器环境的规则

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

1、如果网站根目录存在其他非emlog文件,则需要添加再添加一条规则,如rss.php文件

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

2、如果网站根目录存在其他非emlog目录,则需要添加再添加一条规则,如t目录、m目录、admin目录

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

三、nginx服务器环境的规则

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

四、支持web.config的IIS7/7.5(Microsoft) 服务器环境的规则

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="emlog 5.3.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>

五、支持IIS7.5服务器环境的伪静态规则

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

六、注意事项

1、本教程所使用的规则必须服务器支持伪静态规则必须在后台开启伪静态

2、本教程使用的伪静态规则后出现网站异常,可能是您的服务器不支持自定义规则,请联系主机服务商修改规则部分

3、本教程使用的伪静态规则需要自行写入规则,比如支持httpd.ini的IIS6服务器环境的规则需要写入httpd.ini文件并上传到服务器根目录

版权归属: 博客志
相关推荐

评论区

博主头像
博客志
知道不知道
  • 892

    文章

  • 0

    评论

  • 813347

    浏览