Manual:Short URL/wiki/Page title -- Saetta Web Server--root access

From MediaWiki.org
Jump to: navigation, search

Example configuration:

  • Wiki is installed in /w/ directory in the virtual server root directory.
  • You want to avoid index.php
  • You want to access articles as /wiki/Article

Pretty URLs with Saetta Web Server[edit]

To use pretty URLs with Saetta Web Server a properly configured URL rewriting module written in the C programming language is required.

  1. Download the module
  2. Configure the module
  3. Build the module
  4. Add the URL rewriting module to the server software
  5. Restart the web server or reload its configuration
  6. Edit the LocalSettings.php file

Download the module[edit]

Direct download link to the source code of the module.

Configure the module[edit]

Optionally edit the file mediawiki.c to change the default paths.

Search for the WIKIMEDIA_SHORTENED and WIKIMEDIA_ORIGINAL defines:

#define WIKIMEDIA_SHORTENED WIKIMEDIA_SHARED "/wiki/"
#define WIKIMEDIA_ORIGINAL WIKIMEDIA_SHARED "/w/"

Replace the path /wiki/ with the path you want to use to short web addresses. Replace the path /w/ with the path to the real files on your server.

Build the module[edit]

Build the module using the GNU C compiler:

gcc -Wall -shared -O3 -s -fPIC -o mediawiki.so mediawiki.c

Add the URL rewriting module to the server software[edit]

Upload the module to the server if compiled off site, and then add it to the XML configuration file of your server:

<websites>
   <website host=":80">
       <urlrewriters>
           <urlrewriter enabled="1" path="mediawiki.so" entrypoint="saetta_main" />
       </urlrewriters>
       ....
   </website>
</websites>

Set as path, the full or the relative path to the compiled module.

Restart the web server[edit]

Start or restart the web server.

Edit the LocalSettings.php file[edit]

Edit LocalSettings.php and add the following:

$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
  • That's all