User:Endenizen/URL Rewriting

From Noisebridge
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

URL Stuff for noisebridge wiki

LocalSettings.php in /wiki

$wgScriptPath should already be defined. Wiki should be installed/moved to the /wiki dir. (first two lines may be optional)

$wgScript        = "$wgScriptPath/index.php";
$wgRedirectPath  = "$wgScriptPath/redirect.php";
$wgArticlePath   = "/wiki/$1";

.htaccess in /wiki

Verifies that we're not trying to access an actual file, then passes us off to the wiki script.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)$ index.php?title=$1

.htaccess in /

Redirects us to the /wiki article if there is a '/' on the end of index.php or to an edit page if it finds a query string (ie: if we saved a link to an edit page with the old scheme, it should work just fine with the new scheme).

RewriteEngine On
RewriteRule ^index.php/(.+)$ /wiki/$1 [R]
RewriteCond %{QUERY_STRING} !=""
RewriteRule ^index.php$ /wiki/index.php [R,QSA]