WordPress.org

Forums

rewrite probs - mediawiki subdirectory under wordpress (7 posts)

  1. taglad
    Member
    Posted 7 years ago #

    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

    http://www.example.com/wiki/mypage

    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 ! :-)

  2. jagwire
    Member
    Posted 7 years ago #

    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>
    
    <IfModule mod_rewrite.c>
    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    </IfModule>

    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.

  3. eastonellsworth
    Member
    Posted 7 years ago #

    Thanks jagwire - you saved my hair too. :) Great solution.

  4. RyuMaou
    Member
    Posted 6 years ago #

    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!

  5. wmburke
    Member
    Posted 6 years ago #

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

  6. GATEKeeper
    Member
    Posted 6 years ago #

    HUGE help - thanks!

  7. techguy
    Member
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic