Skip to content

URL/redirect rules for WordPress and MediaWiki together (Part 1)

This is a big pain. Part 1 because I didn’t get it working tonight. I’ll try again when I’m more sane! This is of interest to me, mainly, and possibly anyone else battling against WordPress’s automatic redirects to make readable URL’s, and then getting them to cooperate with any other system files.

WordPress is being used to host (most) of the pages, and journal content. It is “installed” in the folder /journal. However, only the journal archives (such as this post) is stored here in URL form – the other pages, such as Work and so forth, are “fake” url’s. I’d prefer them to stay that way, and I could always have the /journal content in the root folder if I wanted. (Read on for what I’ve done)

The rules WordPress creates using it’s pretty URL’s are:


# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

This is added to the root folders .htaccess file (since I’m on a shared host, I can’t use much else).

However, I want to get MediaWiki working – for this purpose, I have created a /projects folder to test a brand new 1.11 installation of MediaWiki. I created a nice new DB and DB user for it to use before I started. It installed fine (somehow!) but yet, after I closed my browser to access the main page again, it completely failed with the standard WordPress “Page Not Found”. WordPress was still taking over and loading the index.php file from the root! The rules *supposedly* say this shouldn’t happen (the ones ending in !-d and !-f specifically) but they don’t seem to be doing their job.

Agghhh! :(

So, it’s something to do with my WordPress redirects. Notably, the oddity is that I use the base site as the main page, and /journal as the actual location of the pages. Perhaps I could instead make the main page the wordpress installation (as I had months ago) and use /journal as the archive template.

Okay, so I moved the files from /journal to the root, and presto, changed the settings. Hmm, it didn’t help – it still wouldn’t allow access to the wiki pages.

The only difference now is that the things like CSS and the like are not under /journal. This didn’t help – so I changed it back, since I might want to alter the main page to not have WordPress.

I tried a new rule to ignore this subfolder:


# BEGIN WordPress

RewriteEngine On
RewriteBase /
# Add: NOT WIKI SUB
RewriteCond {REQUEST_URI} !^/projects/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

It is meant to say “Condition: If the URL does NOT contain “*/projects/*” …but it didn’t do anything.

I’m now completely confused for the night. I’ll leave it – however I did turn off SSL while doing the rewrite rule changes, and have a working Wiki setup to test – if only I could access it!

If anyone knows anything that could help, I’d like to know. I’d like to eventually get “Proper” URL’s working for MediaWiki, but so far I can’t even get MediaWiki to load.

Resources

Some useful pages related to this:

{ 2 } Comments

  1. Gareth Stack | December 20th, 2008 at 13:18 | Permalink

    Andrew, I’m having this exact problem right now. Did you ever solve it?

  2. Andrew Armstrong | December 21st, 2008 at 1:42 | Permalink

    Afraid not, after I tried all that stuff and some more afterwards, I’ve not had time to go back to it, but Part 2 might appear some day.

    If you have any luck give me a shout. If you have access to apache’s settings, you can make it so htaccess files only execute for their directory or something (at the very least, so a subdomain can work with only it’s own htaccess file), which should solve it. Sadly I can’t do this on my host.

Post a Comment

Your email is never published nor shared. Required fields are marked *