BasicsThis is a module for the Apache webserver and rewrites requested URLs on the fly. It operates both in per-server context (Apache v2.x:
apache2.conf) and per-directory context (
.htaccess). Detailed informations can be found on the Apache Module Homepage[link2].
So what does it to WackoWiki?
- mod_rewrite enabled:
- mod_rewrite disabled:
Howto enable mod_rewriteOf course, you need an Apache webserver WackoWiki is running on, and the module mod_rewrite has to be installed and activated.
mod_rewrite in your Apache configuration file (http.conf oder apache2.conf):
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule rewrite_module modules/mod_rewrite.so
AllowOverride AllMake sure that your .htaccess files are not ignored: in your apache configuration file (http.conf or apache2.conf), make sure that for the directory where the wiki is:
is not set. Because then .htaccess files are ignored[link3].
.htaccessIf you have no privileges to edit the apache2.conf (e.g. you rent webspace) or simply you don't want to, you have to use the
.htaccess-method (don't forget the dot!) with the following content:
R5.5 and on
# No user serviceable parts inside # If you want to fix anything by tuning htaccess - you're possibly on the wrong path <IfModule mod_env.c> SetEnv HTTP_MOD_ENV on </IfModule> <IfModule mod_rewrite.c> <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE on </IfModule> RewriteEngine on RewriteRule ^ index.php [QSA,L] </IfModule> <IfModule !mod_rewrite.c> <FilesMatch \.php$> # Apache 2.4 <IfModule mod_authz_core.c> Require all denied </IfModule> # Apache 2.2 <IfModule !mod_authz_core.c> Order Allow,Deny Deny from all </IfModule> </FilesMatch> <FilesMatch "^(admin|index)\.php$"> # Apache 2.4 <IfModule mod_authz_core.c> Require all granted </IfModule> # Apache 2.2 <IfModule !mod_authz_core.c> Order Allow,Deny Allow from All Deny from None </IfModule> </FilesMatch> </IfModule>
This file is shipped with the WackoWiki package you downloaded, you find this file inside the Wacko folder. If you can't find it, just create it (Permission: -rwxr-xr-x).
httpd.conf / apache2.confIf you want to edit the
apache2.conffile directly, please make sure to delete or rename the
.htaccessin your Wacko folder.
Now add the following lines to your configuration file:
#Wacko URL-rewriting Options Indexes Includes FollowSymLinks MultiViews AllowOverride All RewriteEngine on RewriteRule ^(index.php?.*)$ - [S=1] RewriteRule ^(.*)$ /wacko/index.php?page=$1 [QSA,PT,L] Order allow,deny Allow from all
Restart your webserver to enable the modifications!
Special casesspecial .htaccess files
RewriteBaseIf your webserver's URLs are not directly related to physical file paths, you will need to use RewriteBase in every .htaccess file where you want to use RewriteRule directives.
<IfModule mod_rewrite.c> RewriteEngine on RewriteBase /folder/ </IfModule>