首页 Emlog 正文
  • 本文约852字,阅读需4分钟
  • 215
  • 0

Emlog如何配置服务器支持 URL 重写(伪静态规则)?

温馨提示:本文最后更新于2023年11月16日 10:46,若内容或图片失效,请在下方留言或联系博主。
摘要

Emlog如何配置服务器支持 URL 重写(伪静态规则)Emlog伪静态代码

Nginx服务器:

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

Apache服务器:
只需要开启支持.htaccess,检查 http.conf 配置文件:

1.确保已加载mod_rewrite模块,去掉如下配置行前的#注释符号

LoadModule rewrite_module modules/mod_rewrite.so

2.将AllowOverride指令设置为All

AllowOverride All

Windows IIS 服务器

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 /up(d.d.d)to(d.d.d).php(.*) /up$1to$2.php$3 [L]
    RewriteRule ^/$ /index.php [L]
    RewriteRule /(.*) /index.php/$1 [L]

IIS7/8/10,创建文件web.config,填写下面内容,放入根目录即可

<?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="emlog Rewrite" 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>
标签:emlog
评论