User:MathiasErtl/Apache Macro for MediaWiki

If you have more than one MediaWiki and you might want to use the mod_macro Apache-module. With this module, you only have to write the configuration once and it is possible to update the apache-configuration for all wikis at once.

Install mod_macro
See mod_macro Documentation.

Write a macro
This is of course essentially up to you.

Below is what we use in our WikiFarm. It is a bit more powerful since it does some very nice things:
 * Uses very-short-URLs (you must configure your wiki to use that, too)
 * Redirects index.php/PAGENAME links to /PAGENAME
 * Allows you to specify additional exceptions for the index.php-rewriting

Just save this code to a file:

Next, you must include it in httpd.conf. If you plan on having more than one macro, you can use wildcards:

The final step is to actually use the macro where-ever you want a MediaWiki: The first parameter ('/path...') is the path where your wiki is located. The second parameter is the scriptPath to your Wiki. With the third parameter you can optionally specify additional excludes, i.e. if you want to have other projects in a subdirectory. If you don't want any additional excludes, specify a dash ('-'), otherwise, separate each of them with a pipe ('|') - they become part of a regular expression.