Extension:Special404

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
Special404

Release status: beta

Implementation Special page
Description Provides a simple wiki based 404 special page destination
Author(s) Daniel Friesen (DantmanTalk)
Last version 1.1
License GPL2+
Download

Check usage (experimental)

Special404 provides a simple wiki based 404 special page destination you can configure for your wiki. The body of the 404 page can also be customized using MediaWiki:Special404-body on your wiki.

[edit] Installation

  1. Download a snapshot and extract it to your extensions directory. Choose the version that matches your version of MediaWiki.
  2. Add
    require_once( "$IP/extensions/Special404/Special404.php" );
    to the bottom of LocalSettings.php.
  3. Initial installation can now be verified through Special:Version of your wiki.
  4. Add some webserver config to redirect 404s to the special page, usually this is in the form of a .htaccess config, more information in the section below or in the extension's README.

[edit] WebServer Config

Since this is a 404 handler your webserver will need a little configuration to get it working.

[edit] Apache

Using an ErrorDocument doesn't seem to work in apache, whatever the destination you set, Apache seems to direct to something that MediaWiki interprets normally instead of as a request to display the special page, so we use a rewrite rule instead. You can place the following in your .htaccess file to make the extension work. Be sure to tweak the path to index.php to match the proper path to yours. Also make sure that this is the last rewrite rule, you do not want any rewrite rules after this one they will likely be overridden.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?.*$ /index.php?title=Special:Error404

Keep in mind that it's important that you use /index.php?title=Special:Error404 (with the proper path to index.php of course) and not something like /wiki/Special:Error404 as using the latter causes MediaWiki to treat it normally and direct you to the main page instead of displaying the 404 page.

Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox