Extension:FilePageMasking

The FilePageMasking extension makes it easier for web users and search engines to recognize that file description pages contain HTML by changing the extension at the end of the file description page from ".xxx" to "_xxx", i.e. the URL is transparently changed from pointing at File:Foo.jpg to File:Foo_jpg. When a file description page of the form "_CDC" is requested, the extension automatically translates it back to ".xxx" before fetching the page. For backwards compatibility, all ".xxx" links to file description pages will also continue to function normally.

Installation
Download the source files into your extensions/ directory, then add the following to your LocalSettings.php:

Configuration
The choice of masking character can be set by adding

to LocalSettings.php, where '?' is replaced by the character you wish to use. By default this is set to '_'.

The setting of this variable must be a single character, and must be valid in a URL. Likely alternatives to '_' include '!' or ':'.

This extension relies on $wgFileExtensions to determine the list of case insensitive file extensions to translate. In the default Mediawiki install, with $wgStrictFileExtensions set to true, this will already be configured as a comprehensive list of allowed file extensions, and no further action is needed. On sites where $wgStrictFileExtensions is set to false, the user may upload files with extensions not considered by $wgFileExtensions. If this is the case, those file extensions will not be masked.