Стандартный .htaccess для MediaWiki
Оригинальный файл .htaccess для MediaWiki будет полезен в том случае, если вы его случайно удалили или некорректно отредактировали.
О MediaWiki
«MediaWiki — написанное на PHP свободное программное обеспечение с открытым исходным кодом, реализующее гипертекстовую среду «вики» (wiki) и изначально создававшееся в качестве «движка» Википедии».
— mediawiki.org
Исходный код
Содержимое стандартного файла .htaccess для CMS MediaWiki.
RewriteEngine On
# If using a subdirectory like htdocs/wiki/ Not necessary when the wiki is in htdocs/ (i.e. the root)
# RewriteBase /wiki
# Don't rewrite requests for these MediaWiki subdirectories and files
# you may need to change "stylesheets" to "skins" (v1.4?)
RewriteCond %{REQUEST_URI} !^/(skins|images|mw-config|extensions)/
RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index).php
# other notible conditions
RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/load.php
RewriteCond %{REQUEST_URI} !^/api.php
RewriteCond %{REQUEST_URI} !^/robots.txt
# Make sure there is no query string - unless user is making a search
RewriteCond %{QUERY_STRING} ^$ [OR] %{REQUEST_URI} ^/Special:Search
#I suspect that people who use /wiki will need the following line, but I'm not sure:
#RewriteCond %{REQUEST_URI} ^/wiki$
# Rewrite URI/foo properly, this is the main rule.
RewriteRule ^(.*)$ /index.php/$1 [L,QSA,NE] # Quirk: Truncates question marks (%3F)
RewriteRule ^(.*)http:/(.*) /$2 [R=301]
# If using a subdirectory like htdocs/wiki/ Not necessary when the wiki is in htdocs/ (i.e. the root)
# RewriteBase /wiki
# Don't rewrite requests for these MediaWiki subdirectories and files
# you may need to change "stylesheets" to "skins" (v1.4?)
RewriteCond %{REQUEST_URI} !^/(skins|images|mw-config|extensions)/
RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index).php
# other notible conditions
RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/load.php
RewriteCond %{REQUEST_URI} !^/api.php
RewriteCond %{REQUEST_URI} !^/robots.txt
# Make sure there is no query string - unless user is making a search
RewriteCond %{QUERY_STRING} ^$ [OR] %{REQUEST_URI} ^/Special:Search
#I suspect that people who use /wiki will need the following line, but I'm not sure:
#RewriteCond %{REQUEST_URI} ^/wiki$
# Rewrite URI/foo properly, this is the main rule.
RewriteRule ^(.*)$ /index.php/$1 [L,QSA,NE] # Quirk: Truncates question marks (%3F)
RewriteRule ^(.*)http:/(.*) /$2 [R=301]