IIS Mod-Rewrite solutions
Overview Documentation Download Purchase FAQ  
IIS Mod-Rewrite - URL rewrite tool for IIS

Nice URLs for DokuWiki on IIS using .htaccess

23 Dec 2008

This article describes a detailed, step-by-step guide for enabling Short URLs on DokuWiki on IIS web server

This solution requires IIS Mod-Rewrite Pro and IIS 6.0 or later, and it is tested with DokuWiki 2007-06-26b, PHP 5.2.4, and MySQL 5.0.24.

To enable Nice URLs on DokuWiki on IIS, follow these steps:

  1. Install PHP following the vendor's instructions.

  2. Install IIS Mod-Rewrite Pro (download).

  3. If on production environment, activate IIS Mod-Rewrite using a valid license key. If activation is skipped, IIS Mod-Rewrite will work in test mode and you will need to restart IIS every 30 minutes or 1000 requests, if your testing exceeds these limits.

  4. Install DokuWiki according to the vendor's instructions.

  5. Open the file .htaccess in DokuWiki root directory, and uncomment all the RewriteXxxx directives except for RewriteBase. The part of the file that contains those directives should look like this:

    ## Uncomment these rules if you want to have nice URLs using
    ## $conf['userewrite'] = 1 - not needed for rewrite mode 2
    RewriteEngine on
    ## Not all installations will require the following line. If you do,
    ## change "/dokuwiki" to the path to your dokuwiki directory relative
    ## to your document root.
    #RewriteBase /dokuwiki
    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

  6. Make sure IIS has sufficient access rights to the file .htaccess. The user group IIS_WPG (if running on IIS 6), or the user group IIS_IUSRS (if running on IIS 7), or the current Application Pool's Identity User must have at least "read" access rights to the ".htaccess" file or to the directory that contains this file.

  7. Log on to DokuWiki as administrator, go to admin panel, open the "Configuration Settings" page, scroll down to "Advanced Settings" section, choose .htaccess for the field "Use nice URLs", and save your changes.

After, completing all the steps above, your DokuWiki installation will fully serve Short URLs, and your website's SEO will be drastically improved.

Download and try
IIS Mod-Rewrite

IIS rewrite

Download IIS Mod-Rewrite

Purchase IIS Mod-Rewrite