Jump to content

Extension:SaneCase

From mediawiki.org
MediaWiki extensions manual
SaneCase
Release status: stable
Implementation User interface
Description Automatic correct case mistakes.
Author(s) Martin Tournoij (Carpetsmokertalk)
Maintainer(s) Ciencia Al Podertalk
Latest version 2.0 (2023-10-12)
MediaWiki 1.35+
PHP 7.3+
License MIT License
Download

The SaneCase extension automatically corrects case mistakes. For example if the page Test exists, and someone goes to TEST, they will be automatically redirected to Test with a 301.

This is really much more sane than the default case-sensitivity.

This implements the "Auto redirect option" from Case sensitivity of page names:

“ Automatically redirect to a page that has same spelling but different capitalization (have the computer do the disambiguation pages when a spelling doesn't match an existing page)

Negatives: Performance and possible search engine duplicate content penalties caused by MediaWiki's redirection mechanism.

”

My response to that:

  • It's one very simple query, the performance hit should be almost unnoticeable for most sites.
  • The user having to figure out the correct URL is often more of a performance hit, not to mention a huge usability hit. Plus these are the sort of responses that can be cached very well in Varnish or whatnot.
  • This extension uses a 301 "Moved Permanently" redirect, that should be fine for search engines.

Also note that bing bot usually likes to crawl your site assuming it's case insensitive, rewriting all your valid URLs into lowercase, causing lots of 404 error responses in the logs, and possible crawl errors that could prevent some of your pages to be indexed properly on that search engine.

Installation

  • Download and place the file(s) in a directory called SaneCase in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'SaneCase' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.