From ESWStanford

Jump to: navigation, search

The wiki can now be accessed by the shorter URL http://www.stanford.edu/group/esw/wiki/Main_Page as well as the original http://www.stanford.edu/group/esw/cgi-bin/mediawiki/index.php?title=Main_Page. Implemented by Kristof 15:47, 6 February 2007 (PST)

See mediawiki manual for a brief description of how to do this. Basically there are two files governing this process: .htaccess in our WWW directory and LocalSettings.php in the cgi-bin/mediawiki directory.

.htaccess

The rewrite rule suggested by Mediawiki above works with the Stanford-appropriate parameters and is put in .htacces in the WWW directory:

# first, enable the processing - Unless your ISP has it enabled
# already.  That might cause weird errors.
RewriteEngine On

# do the rewrite (see http://www.mediawiki.org/wiki/Manual:Short_URL)
RewriteBase /group/esw/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.*) cgi-bin/mediawiki/index.php?title=$1 [PT,L,QSA]

Getting rid of /group/esw/

At some point, we way want to have the URL esw.stanford.edu go directly to www.stanford.edu/group/esw/wiki/Main_Page. A rule similar to the following would have to be put before the RewriteRule above, and after the RewriteEngine.

# uncomment this rule if you want Apache to redirect from www.mysite.com/ to
#  www.mysite.com/wiki/Main_Page
# RewriteRule ^/$ /wiki/Main_Page [R]

LocalSettings.php

LocalSettings.php was edited to add the line

$wgArticlePath      = "/group/esw/wiki/$1";

so that links created in the wiki point to the new shorter URL.