It's better when it's simple

User Tools

Site Tools


A new version of this htaccess backend is available here

The config options have changed in the new, if you are looking for the old info, then you probably want to use the Old revisions button.

The old code is still available at

Discussion below left for posterity. I've attempted to address most of the issues raised in the new version.


If I understand the purpose of this authentication method, it allows the task of authentication to be handled externally by the web server, with fallback to DokuWiki, and all group administration to be managed locally (and compatible with the user manager plug-in). If that's true, then this authentication method would be very useful in environments with an existing authentication source (e.g. Active Directory) that don't wish to use that same authentication source for group membership. One question though. Has anyone been able to get this to work under Windows/IIS? — Gary 2007-02-14 21:30

If it's helpful I wrote a howto a while ago about how to get Apache to authenticate against an Active Directory server. – Adam Shand
Interesting thought. You'll need cando['modPass'] set to false and I'm not sure how that would work with User Manager when adding users. Happy to help if someone wants to try this out. — Grant Gardner 2007-04-11 13:57

I'm interested to know if someone has tried any of the “Test” TODO items above and the results. In particular if you've used this on Windows or a real Apache implementation. — Grant Gardner 2007-04-11 13:57

* please add a “defaultdomain” type option that would be the default domain name for e-mail addresses (instead of localhost) [ +1 vote – 2007.01.03 MiMe ]

* I don't really get it. Where can I tell dokuwiki to get the user/password from the http session instead of displaying the login page (IMHO that's all i need to do) Also I can't use the solution above, because we use http auth with ldap as backend and not with a flat file..

  • Bug: doku.php?do=check isn't working because cookie is not set properly – 2007.01.03 MiMe

* I guess I did something wrong in DokuWiki Release 2007-06-26b, but by doing everything as suggested the “admin” option disappears and is generally not available. I found a solution. I had to create .htgroup with admin group. – Muki 2008-29-1

* Tip: if your auth config is in your main apache config you can set $conf['htaccess_file'] to point to the main config Versatilia 2008-09-19

* Bug: inc/auth/htaccess.class.php line 422 - assumes no spaces before AuthUserFile/AuthGroupFile directives and separation with single tab/space in apache config. Replace lines 421-424 with this:

  foreach ($lines as $line) {
    $row = preg_split("/\s+/", $line,3);
    if(trim($row[0])==""){ array_shift($row); }
    $var = strtolower(trim($row[0]));
    $value = trim($row[1]);

Versatilia 2008-09-19

* Bug: I'm running this under Apache 2.2.9 / DW 2008-05-05 on a Debian machine and it works well (good front end to managing my htaccess files!), however the mediamanager.php (when adding an image in edit mode) claims “User authentication is temporarily unavailable. If this situation persists, please inform your Wiki Admin”, disabling the ability to upload files. Ex 2008-10-12

* Problem: I'm running this on Solaris (SunOS 5.11) and whenever it tries to save user data, it dies saying it can't get a lock on the file. It's dying on line 461 of htaccess.class.php, and $this→lockFile is pointing to my .htaccess file at the time that it happens. My .htaccess file is chmoded to 777 so I don't think it's a permission issue. I noticed that even though the function is called “lockWrite”, the fopen on line 460 opens the file is opened with 'r'. I changed that to 'r+' and the problem seems to be fixed. Sean 2008-10-14

  • Prior to writing to any of (htpasswd,htgroups,htuser) it tries to get an exclusive lock on .htaccess. It never writes to that file but we have to open it to get a filehandle. Perhaps Solaris needs the file to be opened for writing in order to get an exclusive lock. — Grant Gardner 2008-11-30
tips/htaccessauth2.txt · Last modified: 2008-12-16 11:48 by lwoggardner

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki