Jump to content
  • 0

Mediawiki short URL


M.Smolarz

Question

Hi,

I have taken over the administration of a MediaWiki server at my university (Version: 1.35.2).
It is installed with XAMPP (PHP: 7.4.9 (apache2handler); MariaDB: 10.4.14-MariaDB; ICU: 66.1) in /opt/lampp/htdocs/wiki

I'm currently trying to shorten the URL with the help of this guide, or rather put it into a readable form. So I added this to the httpd.conf:

## https://www.mediawiki.org/wiki/Manual:Short_URL/Apache
# Enable the rewrite engine
RewriteEngine On

# Short URL for wiki pages
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/wiki/index.php [L]

# Redirect / to Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/wiki/index.php [L]

and this to Localsettings.php

$wgArticlePath = "/wiki/$1";

The problem is that the link is fine, but the website then looks like this:

617296766_Screenshot_2021-05-07HauptseiteMST.thumb.png.3def7fc7882364a77f0fb98ad256d303.png

Without this line:

RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/wiki/index.php [L]

Then the web page looks normal again.

Does someone know what's wrong there?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

The location of your real files should not match the virtual directory you set up for short URLs.

Good:

Bad:

  • Files and article path in the same location (e.g. both in /wiki)
  • Files and/or article path in website root

You are in one of the "bad" cases which is why those rewrite rules are not working for you. Extra care is required when doing one of the configurations listed above as "bad", and even with a correct configuration certain article names matching file or directory names will become impossible to create on your wiki.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.