Micronovae
Home Products Downloads Purchase Support Company
Overview Documentation Download Purchase FAQ
 
IIS Mod-Rewrite

Nice URLs for DokuWiki on IIS using .htaccess

9 Apr 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:

  IIS Mod-Rewrite

Download IIS Mod-Rewrite

Purchase IIS Mod-Rewrite
  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 the root of you DokuWiki installation, and uncomment all the Rewrite* 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. 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.