====== Apache ====== [[https://httpd.apache.org/|Apache]] is the most widely used webserver with DokuWiki. Most hosting providers offering PHP hosting will also use Apache. ===== Installation ===== Basically all Linux distributions offer an Apache package for easy installation. Please refer to your distribution's documentation on how to install software packages. Windows user can pick installation packages from various [[https://httpd.apache.org/docs/current/platform/windows.html#down|third party vendors]]. A good alternative is also our [[install:dokuwiki_on_a_stick|DokuWiki on a Stick]]. FIXME MacOS? ===== Adding PHP support ===== PHP can be added through mod_php or fpm. FIXME add info ===== Enabling .htaccess Support ===== [[wp>.htaccess]] FIXME add info See also: [[https://stackoverflow.com/questions/8551740/centos-htaccess-not-being-read|Stackoverflow: htaccess not being read]]. ===== Rewriting for nicer URLs ===== To enable [[:rewrite|URL rewriting]] you first need to enable the [[https://httpd.apache.org/docs/current/mod/mod_rewrite.html|mod_rewrite]] module. On most Linux distributions this can be done by calling: sudo a2enmod rewrite sudo apache2ctl restart Rewrite rules can then be configured on a per vhost base or via a ''.htaccess'' file. The latter is the more common use - see above on how to enable ''.htaccess'' files. Dokuwiki comes with a distribution copy of the [[wp>.htaccess]]-file called ''.htaccess.dist'', simply rename the file to ''.htaccess'' and edit it to uncomment the appropriate lines. Here is an example how the rewrite rules should look like. RewriteEngine on 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 [B,QSA,L] RewriteRule ^index.php$ doku.php Please note that the line ''RewriteBase /dokuwiki'' may not be needed at all. If you use it, you need to replace the ''/dokuwiki'' path with whatever directory you use in your URL to get to the wiki. If your wiki appears at the top level of the domain (e.g. http://example.com points to the start page of the wiki) then use ''RewriteBase /''. B flag is required from apache 2.4.56 in order to avoid error ''AH10411: Rewritten query string contains control characters or spaces'' ==== Apachectl status broken ==== Dokuwiki rewrite rules can affect the //apachectl status// command and make it return a DokuWiki 404 page instead of the server-status page. You can fix that by either adding an exception to the rewrite rules RewriteCond %{REQUEST_URI} !^/server-status$ or creating an empty server-status file in dokuwiki root folder where doku.php is located. See forum post [[http://forum.dokuwiki.org/post/32858|Apachectl status is broken with dokuwiki]] ==== See Also ==== * [[https://stackoverflow.com/questions/9153262/tips-for-debugging-htaccess-rewrite-rules | Tips for debugging .htaccess rewrite rules]]