Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk8 min

How to Enable Short URLs in MediaWiki (Apache and nginx)

A practical guide to changing MediaWiki article links to /wiki/Page_title, with matching LocalSettings.php values, Apache and nginx rules, testing steps, and fixes for redirect loops and 404 errors.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To change MediaWiki links from /w/index.php?title=Main_Page to /wiki/Main_Page, configure two layers together: your web server must route /wiki/ requests to MediaWiki’s index.php, and LocalSettings.php must tell MediaWiki to generate and interpret that path. A common layout keeps the application in /w while publishing articles below /wiki/.

The procedure is different for Apache and nginx, but the MediaWiki settings are the same. You do not need the optional UrlShortener extension for ordinary article URLs.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What MediaWiki short URLs are—and what they are not

A default MediaWiki installation often exposes an article through a query-string URL such as /w/index.php?title=Main_Page. A short-URL layout removes the visible index.php?title= portion and presents the same page as /wiki/Main_Page.

This is not accomplished by changing only one setting. The browser request first reaches Apache or nginx. The server must recognize the public /wiki/ path and internally send it to MediaWiki’s front controller, index.php. MediaWiki then parses the page name and serves the article. The official Apache guidance describes the goal as aliasing paths to /index.php and letting MediaWiki handle parsing and routing according to LocalSettings.php; see the MediaWiki Apache manual.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

In the common arrangement used below:

  • MediaWiki’s files and executable entry point are reachable at /w.
  • Public article links begin with /wiki/.
  • The web server rewrites /wiki/Page_title to /w/index.php without adding a title query parameter.
  • MediaWiki itself resolves the remaining path to the page title.

If your installation lives somewhere else, substitute your real application and public paths consistently in both the server configuration and LocalSettings.php.

Choose the URL layout before editing anything

The examples assume the MediaWiki application is installed in a directory named w and that article URLs are published beneath /wiki/. This separation is important: /w identifies where MediaWiki runs, while /wiki/ is the reader-facing article namespace.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Decide whether MediaWiki is installed at the web host’s root or below a separate site path. For example, an installation under https://example.org/ can use /w and /wiki/ directly. If it is under https://example.org/knowledge/, the equivalent paths need that prefix, and the rewrite rules must be adapted accordingly. Do not copy the root-level rules unchanged into a subdirectory deployment.

Set the MediaWiki URL variables in LocalSettings.php

Open the LocalSettings.php file generated for your wiki and set the two variables that define the application and article paths:

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

$wgScriptPath is the URL path to MediaWiki’s main script. $wgArticlePath controls the internal article links MediaWiki generates, with $1 replaced by the page name.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Some PHP and web-server combinations do not expose path information in the way MediaWiki expects. If short URLs trigger a redirect loop, or path information is not handled correctly, add:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$wgUsePathInfo = true;

Use that setting when the behavior of your server and PHP mode requires it; it is not a universal requirement. The official variable guidance is in Manual:Short URL/LocalSettings.php.

Save a copy of the working file before making changes. Keep the slash and capitalization in each path exactly as deployed, and make sure the public /wiki/ path is not accidentally set to the same path as the application’s /w directory.

Configure Apache

Enable rewrite support

Apache must have mod_rewrite enabled. On a server where you control the virtual-host configuration, place the rules in the relevant Apache configuration. On shared hosting, a .htaccess file in the web root above the /w directory can be used when the host permits overrides through AllowOverride.

Add the routing rules

The following representative pattern routes article requests to MediaWiki and leaves existing files and directories alone:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]

The first two conditions prevent Apache from rewriting a request that already maps to a physical file or directory. The first rule catches requests beginning with /wiki/ and sends them to /w/index.php. The final rule provides a general entry-point fallback for the site root and other requests covered by your deployment.

Keep the destination pointed at index.php. Do not change the rule to append ?title=$1; MediaWiki is intended to parse the path using the settings in LocalSettings.php. The official examples and the assumptions behind this pattern are documented in Manual:Short URL/wiki/Page Title — .htaccess and the Apache short-URL manual.

Apply the Apache configuration

  1. Confirm that the rule is loaded in the virtual host or that .htaccess overrides are allowed for the directory containing the file.
  2. Save the configuration and reload Apache, or perform a graceful restart using the service procedure for your operating system.
  3. Open a known page such as /wiki/Main_Page. Then follow an internal link and check that MediaWiki generates the /wiki/ form rather than the old query-string form.

If Apache reports a configuration error, restore the previous file, check the spelling and placement of each directive, and verify that rewrite support is available before trying again.

Configure nginx

Add a location and rewrite rule

In the nginx server block for the wiki, add a location that captures the public article path and internally sends it to MediaWiki’s entry point:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
location /wiki/ {
    rewrite ^/wiki/(?<pagename>.*)$ /w/index.php;
}

The named capture identifies the portion after /wiki/; MediaWiki receives the request through /w/index.php and uses the matching LocalSettings.php values to resolve it. Keep the article-path setting and the nginx location aligned: a different public prefix requires a different regular expression and a different $wgArticlePath.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Preserve the rest of the nginx deployment

The official nginx example includes separate handling for the application entry point, static assets, REST requests, the favicon, and the site root. Add the article location without removing those other locations, and adapt their paths to your deployment. The complete reference is MediaWiki’s nginx short-URL manual.

Reload and test nginx

  1. Validate the nginx configuration with the normal configuration-test procedure for your installation.
  2. Reload nginx so the new server block is active.
  3. Request /wiki/Main_Page, open a few internal links, and check that images, stylesheets, scripts, and other assets still load from their expected paths.

If the configuration test fails, correct the syntax before reloading. If the test passes but requests fail, inspect the nginx error log and verify that the /w application path exists and is readable by the web server.

Verify the finished setup

Test the change from the outside in rather than relying only on the home page:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Direct article request: open /wiki/Main_Page or another page that is known to exist. It should render the article instead of returning a 404 or a server error.
  2. Generated links: use links inside the page. They should use /wiki/Page_title rather than /w/index.php?title=Page_title.
  3. Assets: confirm that the skin, images, JavaScript, and CSS load normally. A rewrite that catches static files can make a page appear unstyled even though article routing works.
  4. Application access: verify that the underlying MediaWiki entry point and administrative functions still work as intended for your deployment.
  5. Page names: test a title containing spaces, punctuation, or a subpage separator if your wiki uses those conventions. This confirms that the path is being handed to MediaWiki for parsing rather than treated as a literal file path.

Use your browser’s network or developer tools to distinguish an HTTP redirect from an internal rewrite. The short-URL rule should not require adding a visible title query string to the browser’s address.

Troubleshoot common failures

Symptom Likely cause What to check
“Redirect loop detected!” Path-info handling or application/public paths are inconsistent. Try $wgUsePathInfo = true; when your PHP/server mode needs it. Confirm that $wgScriptPath is /w, $wgArticlePath is /wiki/$1, and the server is not rewriting /w back into /wiki/.
/wiki/Main_Page returns 404 The server rule is missing, inactive, or points to the wrong entry point. For Apache, verify mod_rewrite, rule scope, and AllowOverride if using .htaccess. For nginx, verify the location /wiki/ block and reload.
Article loads but links still use index.php?title= MediaWiki is still generating its old article path. Check that $wgArticlePath = "/wiki/$1"; is in the active LocalSettings.php, with no later configuration overriding it.
Page is unstyled or images fail A broad rewrite is catching existing files or directories. On Apache, retain the !-f and !-d conditions. On nginx, keep the asset and entry-point locations from the rest of your deployment and inspect the server log for the requested asset path.
Internal server error after editing Apache Invalid directive, unavailable rewrite module, or disallowed .htaccess override. Check Apache’s error log and configuration-test output, then confirm that the rules are placed where your host permits them.
Short URLs work at the root but fail in a subdirectory Root-level examples were copied into a prefixed installation. Add the installation prefix consistently to the public article path, rewrite expression, script path, and any related nginx locations.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Apache and nginx: which setup fits?

Consideration Apache nginx
Where routing is defined Virtual-host/server configuration, or .htaccess when overrides are permitted. The nginx server block, using a location and rewrite.
Required routing feature mod_rewrite. nginx rewrite support.
Shared-hosting practicality Often workable through .htaccess, subject to AllowOverride. Usually requires access to the server configuration; per-directory override files are not the nginx model.
Article destination /w/index.php in the representative rule. /w/index.php in the representative location.
MediaWiki settings $wgScriptPath = "/w"; and $wgArticlePath = "/wiki/$1";; add $wgUsePathInfo = true; only when the server/PHP combination requires it.
After editing Reload or gracefully restart Apache. Validate and reload nginx.

The public URL design does not change between servers. Only the syntax, configuration access, and reload procedure differ.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Do you need the UrlShortener extension?

No—not for replacing /w/index.php?title=Page with /wiki/Page. Those article URLs are a core web-server and MediaWiki configuration task.

Extension:UrlShortener is a separate, optional feature for generating redirect-style short links. Its documentation describes settings such as:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
$wgUrlShortenerTemplate = '/r/$1';

It can also use a custom $wgUrlShortenerServer. Very short custom paths still require mod_rewrite or an equivalent server mechanism. Install that extension only when you specifically want redirect links such as an /r/ namespace; it is not a prerequisite for normal /wiki/ article routing.

Operational checklist

  • Back up LocalSettings.php and the active web-server configuration before editing.
  • Write down the actual application path and desired public article prefix.
  • Set $wgScriptPath and $wgArticlePath to matching values.
  • Add the server rule that routes the public article path to index.php, without appending ?title=$1.
  • Enable the required rewrite feature and ensure the configuration is allowed in the place you edited.
  • Reload the server and test a known article, generated links, and static assets.
  • If a loop or error appears, inspect logs first and re-check path-info handling, rewrite scope, and the distinction between /w and /wiki/.

Reference documentation

For syntax and deployment variations, consult the relevant official manuals:

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.