I need to move the DokuWiki data directory away from its default location (because I keep the installation and configuration in version control, but data needs to kept elsewhere, in order to be properly backed up and not be clobbered when upgrading the software version).

How do I this? Is there a simple configuration file? Are there any gotchas?


You can change the default location of the data directory by editing /conf/dokuwiki.php

Find line 22 and look for 'savedir' below is the snippet of this entry.

$conf['savedir']     = './data';          //where to store all the files
  • you should not modify conf/dokuwiki.php it will be overwritten on update. Instead create a conf/local.php with the changed setting. – Andreas Gohr Nov 17 '14 at 8:59

I wanted to do a similar thing to keep as much writable stuff out of 'www' as possible, so moved the 'conf' and 'data' folders to a new 'wikifiles' folder.

Assuming that your paths are going to become "var/wikifiles" and "var/www/dokuwiki":

  1. Move the 'data' and 'conf' folders to 'var/wikifiles'.
  2. Do not edit 'conf/dokuwiki.php'.
    Edit 'conf/local.php' (or create it based on 'conf/local.php.dist') and set the value of $conf['savedir'] to your new path, e.g: $conf['savedir'] = '/var/wikifiles/data';.
  3. Edit or create a file called 'preload.php' in 'var/www/dokuwiki/inc' and define a path to the 'conf' folder, e.g: define('DOKU_CONF','var/wikifiles/conf/');

One gotcha would be if you're moving an existing installation, especially if it's not working as expected: Always check for 'inc/preload.php' as well as 'conf/local.php'. I always remember to do that, and totally didn't just waste a few moments staring blankly at a "The datadir ('pages') at /pages is not found" message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.