1. Apache mod_rewrite
WackoWiki mit mod_rewrite verwendenWenn Apache das Modul mod_rewrite einkompiliert hat (und dein Provider "RewriteEngine On" auch ausführen lässt...),
ist es ganz einfach, URL rewriting einzustellen:
- kopiere die .htaccess[link2]-Datei, die bei WackoWiki mitgeliefert wird in dein Installationsverzeichnis
- setze in der Konfiguration[link3]
'rewrite_mode' => 1
1.1. Grundlagen
Mod_rewrite ist ein Modul für den Apache Webserver[link4] und schreibt die angeforderte URLs on the fly um. Es funktioniert beides in per-server context (Apache v2.x:apache2.conf
) und per-directory context (.htaccess
). Detaillierte Informationen findet man unter Apache Module mod_rewrite[link5] und URL Rewriting Guide[link6].- mod_rewrite ermöglicht:
-
http://www.example.com/Download
-
- mod_rewrite verhindert:
-
http://www.example.com/?page=Download
-
1.2. Wie man mod_rewrite aktiviert
Du benötigst einen Apache Webserver[link4] auf dem WackoWiki läuft und das Module mod_rewrite muss installiert und aktiviert sein.mod_rewrite in der Apache Konfigurationsdatei (http.conf oder apache2.conf):
/apache/conf/http.conf
aktiviert:
LoadModule rewrite_module modules/mod_rewrite.so
deaktiviert
#LoadModule rewrite_module modules/mod_rewrite.so
1.2.1. AllowOverride All
Stelle sicher dass deine .htaccess[link2] Dateien nicht ignoriert werden: Stelle in deiner Apache Konfigurationsdatei (http.conf oder apache2.conf) für das Verzeichnis in dem dein Wiki ist folgendes sicher:/apache/conf/http.conf
AllowOverride None
nicht gesetzt ist, weil sonst .htaccess Dateien werden ignoriert[link7].
AllowOverride All
Beispiel mit AllowOverride All:
/apache/conf/http.conf
#Wacko URL-rewriting <Directory "/real/path/to/yoursubdir"> Options Indexes FollowSymLinks Includes ExecCGI # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All Order allow,deny Allow from all </Directory>
1.3. mit .htaccess
Falls man keine Rechte besitzt, um diehttpd.conf
/ apache2.conf
Datei zu bearbeiten (z.B. bei Shared Hosting), dann kann man die .htaccess
-Methode nutzen, mit folgendem Inhalt:In der Datei befinden sich keine vom Benutzer zu ändernde Bestandteile. Falls du irgendetwas durch Ändern der .htaccess beheben willst, dann bist du sehr wahrscheinlich auf dem falschen Weg.
wacko/.htaccess
# 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>
Die Datei .htaccess[link2] ist im Installationspaket von WackoWiki, welches du heruntergeladen hast, enthalten, und findet sich dort im
wacko/
Ordner. Falls du sie nicht findest, erstelle sie einfach (Zugriffserlaubnis: -rwxr-xr-x).
1.3.1. Anpassungen für Domain Factory
Für Wacko.5.0 habe ich in der .htaccess lediglich die ZeileRewriteBase /einfügen müssen. d(f[link8]) voelzke[link9] (18.01.2012 23:17)
1.4. ohne .htaccess
Wenn du die diehttpd.conf
/ apache2.conf
Datei direkt bearbeiten willst, bitte achte darauf, dass du die .htaccess
Datei in deinem Wacko Ordner löschst oder umbenennst.Füge jetzt die folgenden Zeilen in deine Apache Konfigurationsdatei:
/apache/conf/http.conf
#Wacko URL-rewriting Options Indexes Includes FollowSymLinks MultiViews AllowOverride All RewriteEngine on RewriteRule ^ index.php [QSA,L] Order allow,deny Allow from all
Starte deinen Webserver neu, damit die Änderungen aktiv werden!
2. Nginx rewrite
In other locales, parse the URL
if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; }
Referring pages:
- Doc/Deutsch/Aktionen/DateienHochladen[link10]
- Doc/Deutsch/Fehlersuche[link11]
- Doc/Deutsch/Glossar/M/ModRewrite[link12]
- Doc/Deutsch/Installation[link13]
- Doc/Deutsch/Konfiguration[link14]
- Doc/Deutsch/Voraussetzungen[link15]
- Doc/English/ModRewrite[link16]
- [link1] https://wackowiki.org/doc/Doc/English/ModRewrite
- [link2] https://wackowiki.org/doc/Doc/Deutsch/Glossar/H/htaccess
- [link3] https://wackowiki.org/doc/Doc/Deutsch/Konfiguration
- [link4] https://wackowiki.org/doc/Doc/Deutsch/Glossar/A/Apache
- [link5] https://httpd.apache.org/docs-2.4/mod/mod_rewrite.html
- [link6] https://httpd.apache.org/docs/current/rewrite/intro.html
- [link7] https://httpd.apache.org/docs-2.4/mod/core.html#allowoverride
- [link8] http://www.df.eu/de/service/df-faq/technische-faq/htaccess/mod-rewrite/#acc5518
- [link9] https://wackowiki.org/doc/Users?profile=voelzke
- [link10] https://wackowiki.org/doc/Doc/Deutsch/Aktionen/DateienHochladen#a-116
- [link11] https://wackowiki.org/doc/Doc/Deutsch/Fehlersuche#a-116
- [link12] https://wackowiki.org/doc/Doc/Deutsch/Glossar/M/ModRewrite#a-116
- [link13] https://wackowiki.org/doc/Doc/Deutsch/Installation#a-116
- [link14] https://wackowiki.org/doc/Doc/Deutsch/Konfiguration#a-116
- [link15] https://wackowiki.org/doc/Doc/Deutsch/Voraussetzungen#a-116
- [link16] https://wackowiki.org/doc/Doc/English/ModRewrite#a-116