Support » How-To and Troubleshooting » rewrite probs – mediawiki subdirectory under wordpress

rewrite probs – mediawiki subdirectory under wordpress

  • I’m tearing my hair out and quickly going bald trying to solve this problem.

    I want to install mediawiki as a subdirectory under my wordpress install with short urls.

    viz http://www.example.com <- wordpress here, top level

    http://www.example.com/wiki/ <- mediawiki here

    mediawiki pages are re-written so that they are short


    I’ve tried many combinations of editing localsettings.php in mediawiki directory, and .htaccess in wordpress directory, and .htaccess in mediawiki directory with no joy.

    I can achieve what I want by running mediawiki from the top of a domain or sub-domain viz

    my.example.com/mypage <- mediawiki pages rewritten to short url here

    help appreciated. i don’t have many strand of hair left ! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • I had the same problem. Here’s what I did that worked.

    Worpress is installed at the top level )of the site http://www.example.com. MediaWiki is (and must be) installed at http://www.example.com/w/. Pages are rewritten in MediaWiki to look like http://www.example.com/wiki/mypage.

    .htaccess looks like this

    <IfModule mod_rewrite.c>
    # BEGIN MediaWiki
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^wiki/(images|skins|fckeditor)/ - [PT,L,QSA]
    RewriteRule ^wiki/(.*)$ w/index.php?title=$1 [PT,L,QSA]
    RewriteRule ^wiki/*$ wiki/ [PT,L,QSA]
    RewriteRule ^wiki/(.*:.*)$ w/index.php?title=$1 [PT,L,QSA]
    RewriteRule ^wiki/(.+)$ w/index.php?title=$1 [PT,L,QSA]
    # END MediaWiki
    <IfModule mod_rewrite.c>
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress

    LocalSettings.php has the following set:

    $wgScriptPath	    = "/w";
    $wgArticlePath      = "/wiki/$1";

    I think the trick is to have have MediaWiki .htaccess rules first then the WordPress rules. I’m sure the .htaccess file is ugly but it works and I haven’t had a chance to go back and rework it. There are a few urls that still show funny but the work and always redirect back to the friendly urls.

    I hope you hairs grows back.

    Thanks jagwire – you saved my hair too. 🙂 Great solution.

    What version of MediaWiki are you using? Were you able to integrate it into the blog security, too? How about linking back and forth?

    This looks like a great way to do it and I’d LOVE to see a tutorial somewhere!

    Thank you for this solution. I was struggling with integrating the two .htaccess necessities as well.

    HUGE help – thanks!

    Thanks. This worked like a charm for me and saved me having to figure it out myself.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘rewrite probs – mediawiki subdirectory under wordpress’ is closed to new replies.