Manual:Short URL/Page title -- Saetta Web Server

From MediaWiki.org
Jump to: navigation, search

Example configuration:

  • Wiki is installed in /w/ directory in the virtual server root directory.
  • You want to access articles as example.com/Page_Title or www.example.com/Page_Title or wiki.example.com/Page_Title

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_ORIGINAL define:

#define WIKIMEDIA_ORIGINAL WIKIMEDIA_SHARED "/w/"

Replace the path /w/ with the path to the real files on your server.

Everything placed in /w/* will be accessed directly. For example, a file placed in "/w/images/" can be accessed because the redirection module won't be active in "/w/" and after "/w/".

Permanent links of mediawiki will point to

http://host/w/index.php?title=Artikel

If the exceptions haven't been changed only the following addresses won't be rewritten:

http://host/WIKIMEDIA_ORIGINAL (from the first level on = "/w/*")
http://host/favicon.ico
http://host/robots.txt

Build the module[edit]

Build the module using the GNU C compiler:

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

WIKIMEDIA_ROOT should be defined at compiling time in order to turn on a special configuration for the module.

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"><!-- catch all hostname -->
       <urlrewriters>
           <urlrewriter enabled="1" path="mediawiki.so" entrypoint="saetta_main" />
       </urlrewriters>
       ....
   </website>
   <website host="wiki.example.com:80"><!-- or just for: wiki.example.com -->
       <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      = "/$1";
$wgUsePathInfo      = true;
  • That's all