dokuwiki静态化配置

warning: 这篇文章距离上次修改已过312天,其中的内容可能已经有所变动。

Apache

修改DokuWiki的根目录下的.htaccess文件,删除“#”注释即可启用


RewriteEngine o

RewriteRule ^_media/(.*)             lib/exe/fetch.php?media=$1  [QSA,L]
RewriteRule ^_detail/(.*)            lib/exe/detail.php?media=$1 [QSA,L]
RewriteRule ^_export/([^/]+)/(.*)    doku.php?do=export_$1&id=$2 [QSA,L]
RewriteRule ^$                       doku.php  [L]
RewriteCond %{REQUEST_FILENAME}      !-f
RewriteCond %{REQUEST_FILENAME}      !-d
RewriteRule (.*)                     doku.php?id=$1  [QSA,L]
RewriteRule ^index.php$              doku.php

Nginx

修改nginx.conf配置文件添加一下内容即可

rewrite ^(/)_media/(.*) $1lib/exe/fetch.php?media=$2 last;
rewrite ^(/)_detail/(.*) $1lib/exe/detail.php?media=$2 last;
rewrite ^(/)_export/([^/]+)/(.*) $1doku.php?do=export_$2&id=$3 last;
location /
{
    if (!-f $request_filename)
    {
        rewrite ^(/)(.*)?(.*)  $1doku.php?id=$2&$3 last;
        rewrite ^(/)$ $1doku.php last;
    }
}

location ~ /(conf|bin|inc)/ {
    deny all;
}
location ~ /data/ {
    internal;
}
最后修改于:2019年12月17日 17:25

添加新评论

* 已开启反垃圾保护,《隐私政策》