Possible Duplicate: MediaWiki on SubDirectory and SubDomain (However does not come with an answer, nor any replies offering help)

Okay, I am attempting to configure MediaWiki to become installed to some sub-directory. I formerly been with them installed to some primary domain on http://www.example.com/ having a mod_rewrite utilizing a Short Link to /wiki/Main_Title.

Like a note, I am also on HostGator hosting that is shared that has special rules for brief web addresses.

My directory structure is really as such:

  • / (site root; location of .htaccess)
  • /wiki/ (mediawiki root; location of LocalSettings.php)

This is what I attempted,


RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\&(.*)$ $1\%26$2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.+)$ ./wiki/index.php?title=$1 [PT,L,QSA]


## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath       = "/wiki";
$wgScriptExtension  = ".php";
$wgArticlePath      = "$wgScriptPath/$1";

However, I don't get anything. I merely obtain a 403/Forbidden error no 500 Internal Server Error, only a 403 - url http://www.example.com/. It's as though there is nothing being carried out. I have bumped my mind from the wall attempting to figure this out. Any assistance is appreciated.

Thanks ahead of time!

You are on course... if you are on the shared atmosphere, then do this:

RewriteEngine on
# Comment to force base to be the subdir:
# RewriteBase /
RewriteRule ^(.*)\&(.*)$ $1\%26$2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.+)$ ./wiki/index.php?title=$1 [PT,L,QSA]

Two hints:

If you are not inside a located atmosphere (= whether it's your personal server and you will customize the virtual hosts, not just the .htaccess files), use the RewriteLog directive: it allows you to find such problems:

# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On

My personal favorite tool to check on for regexp:

http://www.quanetic.com/Regex (be sure to choose ereg(POSIX) rather than preg(PCRE)!)

What's the reason for

RewriteRule ^(.*)\&(.*)$ $1\%26$2

You've lost me positioned on that one. Any URI having a second parameter will loop indefinitely and produce a 500 status return.

Should you browse the Rewrite documentation:

What's matched up?

...If you want to complement from the ... query string, make use of a RewriteCond using the ... %{QUERY_STRING} variables

The &lifier is generally area of the query parameter. It may come in the RewriteRule pattern within the situation of malformed URI (e.g. fred&q=1). Automatically, mod_rewrite will treat this as fred?q=1, but this converts it towards the steered clear of %26 variant so this is passed like a title fred&q=1 to MW (that is an invalid MW title incidentally). I believe that you ought to eliminate it or at best understand what you're attempting to do here.

The final line ought to be

RewriteRule ^wiki/(.+) wiki/index.php?title=$1 [PT,L,QSA]

and the RewriteBase otherwise mod_rewrite could possibly get confused.

This will work OK:-)