Dokuwiki configure Rewrite optimized path display

Original link: https://www.ixiqin.com/2022/08/28/the-optimum-path-of-dokuwiki-configuration-rewrite-display/

dfe5624d0afe5e8220b907e92766dd4b.png

When Dokuwiki generates URLs, it supports generating three different URLs:

  • Rewrite version: /wiki:welcome?do=admin&page=config
  • dokuwiki control panel: /doku.php/start?do=admin&page=config
  • Default version: /doku.php?id=start&do=admin&page=config

Configuring Rewrite can make the path of your wiki simpler and clearer, and block language information. Therefore, in general, it is recommended that you configure the corresponding rewrite rules.

Add the following rules to your Nginx Host configuration to implement Rewrite forwarding

 location / { try_files $uri $uri/ @dokuwiki; } location @dokuwiki { rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last; rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last; rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last; rewrite ^/(.*) /doku.php?id=$1&$args last; }

After the addition is complete, you can execute the following command to restart Nginx

 nginx -t nginx -s reload

Go back to the configuration manager in the background of Dokuwiki, find the configuration of userewrite , configure it to use .htaccess , and save it, you can turn the URL generated by dokuwiki by default into a cleaner URL.

This article is reprinted from: https://www.ixiqin.com/2022/08/28/the-optimum-path-of-dokuwiki-configuration-rewrite-display/
This site is for inclusion only, and the copyright belongs to the original author.