DokuWiki开源维基百科系统设置URL伪静态,Apache和Nginx规则都有

首先在管理后台找到: 管理 -> 配置管理器 -> 高级设置 -> 使用更整洁的 URL ,然后将其设置为 .htaccess 然后保存!

Apache的伪静态规则:

<IfModule mod_rewrite.c>
     # Uncomment to implement server-side URL rewriting
     # (cf. <http://www.dokuwiki.org/config:userewrite>).
                        # Do *not* mix that with multisite!
     RewriteEngine on
     RewriteBase /dokuwiki
     RewriteRule ^lib                      - [L]
     RewriteRule ^doku.php                 - [L]
     RewriteRule ^feed.php                 - [L]
     RewriteRule ^install.php              - [L]                
     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]
     RewriteRule (.*)                      doku.php?id=$1  [QSA,L]
</IfModule>

Nginx伪静态规则:

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;
  }
}
庄朋龙
庄朋龙

一个爱生活的技术菜鸟

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注