MediaWiki Redirects — Page Moves, Redirects, Double Redirects, and Soft Redirects
In this tutorial, you will learn about MediaWiki Redirects. We cover key concepts, practical examples, and best practices to help you master this topic.
Redirects in MediaWiki automatically forward users from one page title to another using the #REDIRECT directive, handling page moves, broken links, double redirects, and soft redirects — the same system that Wikipedia uses to manage millions of alternative titles and renamed articles.
What You'll Learn
- Creating hard redirects with
#REDIRECT - Moving pages and understanding automatic redirects
- Detecting and fixing double redirects
- Creating soft redirects for external links
- Using redirects in templates and navigation
- Managing redirects at scale
Why It Matters
Pages change. You rename a product. You fix a typo in a title. You reorganize content. Without redirects, every old link breaks. With redirects, users and search engines automatically reach the correct page. Redirects preserve link equity for SEO, prevent 404 errors, and make wiki maintenance safe. Understanding redirects means you can reorganize your wiki without fear of breaking anything.
Real-World Use
A DodaTech wiki renames "DodaBrowser Professional" to "DodaBrowser Pro." The old URL had been linked in 50 documentation pages, 3 external blog posts, and a company newsletter. A redirect ensures all those old links still work. Six months later, a maintenance script finds the redirect and updates the links to point directly to the new title.
Learning Path
flowchart LR A["14: Parser Functions"] --> B["15: Subpages"] B --> C["16: Redirects"] C:::current D["17: Categories"] E["18: Special Pages"] F["19: Watchlist"] C --> D --> E --> F classDef current fill#38bdf8,color#0f172a,stroke-width:2px
What Is a Redirect?
A redirect is a page that contains nothing except a directive telling MediaWiki to send the reader to another page. When a user visits the redirect page, MediaWiki automatically forwards them to the target page.
#REDIRECT [[New Page Title]]
The syntax is simple: exactly one line starting with #REDIRECT followed by a valid wiki link. The redirect happens transparently — the browser URL changes to the target page, and the user sees the target content.
Step 1: Create a Hard Redirect
Create a new page with the title you want to redirect FROM:
- Go to
OldPage(it will be a red link) - Click "Create"
- Enter exactly:
#REDIRECT [[New Page Title]]
- Write an edit summary:
Redirecting OldPage to NewPage - Save
Now, visiting /wiki/OldPage automatically takes you to /wiki/NewPage.
You can add a category to the redirect page if needed:
#REDIRECT [[New Page Title]]
[[Category:Redirects]]
The category applies to the redirect page itself, which is useful for tracking redirects.
Step 2: Move a Page
The Move action renames a page and creates a redirect automatically.
- Navigate to the page you want to rename
- Click the "Move" tab (requires sysop permission or
moveuser right) - Enter the new title
- Choose whether to create a redirect from the old title
- Click "Move page"
After moving, the old title becomes a redirect to the new title. All existing links to the old title still work because they follow the redirect.
Move Options
The move form offers:
- Move page: The main action — renames the page
- Move talk page: Also renames the associated talk page
- Leave a redirect behind: Creates
#REDIRECTfrom the old title (always recommended) - Watch source and target: Adds both titles to your watchlist
Never uncheck "Leave a redirect behind" unless you are certain no links point to the old title.
Step 3: Double Redirects
A double redirect happens when page A redirects to page B, and page B redirects to page C. When a user visits A, MediaWiki follows the first redirect to B, but does NOT follow the second redirect to C. The user sees a broken redirect page instead of the final target.
OldPage → NewerPage → CurrentPage
(redirect) (redirect) (actual content)
User sees: "Redirect page" instead of CurrentPage
How to Fix Double Redirects
Use the Special:DoubleRedirects page. It lists all double redirects on your wiki.
- Go to
Special:DoubleRedirects - For each entry, edit the first redirect to point directly to the final target
- Change
#REDIRECT [[IntermediatePage]]to#REDIRECT [[FinalPage]] - Save
The fix tool on Wikipedia runs bot scripts to fix double redirects automatically after page moves. On smaller wikis, check Special:DoubleRedirects after each page move.
Preventing Double Redirects
Always check for redirects to the page you are moving:
#REDIRECT [[OldPage]] ← This page now points to a redirect
(fix: change to [[NewPage]])
A simple rule: after moving a page, visit Special:WhatLinksHere/NewPage and look for redirects that point to the old title.
Step 4: Soft Redirects
A soft redirect displays a message asking the user to click a link, rather than forwarding automatically. Soft redirects are used for:
- Redirecting to external websites
- Redirecting to special pages
- Redirecting to pages on other wikis (interwiki)
= OldPage =
This page has been moved.
Please visit '''[[NewPage]]''' instead.
[[Category:Soft redirects]]
When to Use Soft Redirects vs Hard Redirects
| Scenario | Type |
|---|---|
| Page renamed within the same wiki | Hard redirect |
| Redirecting to an external URL | Soft redirect |
| Redirecting to Special: pages | Soft redirect |
| Redirecting to another wiki (interwiki) | Soft redirect |
| Temporary redirect during a content freeze | Soft redirect |
| Category pages that should point elsewhere | Soft redirect |
Soft Redirect Template
Create a reusable soft redirect template:
= {{{1|Moved Page}}} =
<div style="border:1px solid #ffc107;background:#fff3e0;padding:16px;margin:12px 0;">
This page has been moved. The new location is:
<br>
'''[[{{{2|}}}]]'''
<br>
Please update your bookmarks.
</div>
[[Category:Soft redirects]]
Usage: {{SoftRedirect|Old Title|New Title}}
Step 5: Redirects in Templates
Templates can create redirects automatically. A template named Template:OldName can redirect:
#REDIRECT [[Template:NewName]]
When someone uses {{OldName}} on a page, MediaWiki follows the redirect and renders Template:NewName instead. The user does not need to update their template call.
This is useful when you rename a template. Create a redirect from the old template name to the new one, and all existing pages continue working.
Step 6: Managing Redirects
Special:BrokenRedirects
This page lists redirects that point to non-existent pages. For example:
#REDIRECT [[DeletedPage]] ← DeletedPage was removed
Fix broken redirects by:
- Editing the redirect to point to a valid page
- Deleting the redirect if it is no longer needed
Special:UnusedRedirects
This page lists redirects that no page links to. These are candidate for deletion. However, be cautious — external links or bookmarks may still use these URLs.
Find Incoming Redirects
To see which pages redirect to a specific page:
- Go to
Special:WhatLinksHere/TargetPage - Check the "Hide links" and "Hide transclusions" checkboxes
- Click "Show redirects only"
The resulting list shows every page that redirects to the target page.
Step 7: Batch Redirect Creation
For bulk redirects (e.g., after a product rename), use the maintenance/importDump.php script or create redirects programmatically.
Using the API
curl -c cookies.txt -b cookies.txt \
"https://yourwiki/api.php?action=edit&title=OldPage&text=%23REDIRECT+%5B%5BNewPage%5D%5D&token=TOKEN&summary=Redirecting"
The URL-encoded text %23REDIRECT+%5B%5BNewPage%5D%5D is #REDIRECT [[NewPage]].
Using a Python Script
import requests
def create_redirect(api_url, session_token, old_title, new_title):
params = {
'action': 'edit',
'title': old_title,
'text': f'#REDIRECT [[{new_title}]]',
'summary': 'Creating redirect',
'token': session_token,
'format': 'json'
}
response = requests.post(api_url, data=params)
return response.json()
Batch redirects are common when migrating content from an old wiki or restructuring page names.
What You Learned
#REDIRECT [[Target]]creates a hard redirect- The Move action renames a page and leaves a redirect
- Double redirects break — fix them by pointing directly to the final target
- Soft redirects display a link for external or special page destinations
Special:DoubleRedirectsandSpecial:BrokenRedirectshelp manage redirects- Templates can redirect to support renamed templates
- The API and scripts can create redirects in bulk
In the next lesson, you'll learn about categories — organizing pages into topic-based groups.
Common Mistakes
| Mistake | Why It Happens | How to Fix |
|---|---|---|
Redirect shows raw #REDIRECT [[...]] text |
Typo in the redirect syntax | Ensure exact spelling: #REDIRECT [[Target]]. Common errors: missing #, lowercase redirect, extra spaces. |
| Double redirect appears after a page move | Not checking for pages that redirect to the moved page | After moving, check Special:DoubleRedirects and fix each entry. Use Special:WhatLinksHere to find incoming redirects. |
| Redirect to an external URL does not work | Hard redirects only work for wiki pages | Use a soft redirect with a message and a clickable link. MediaWiki does not support #REDIRECT [[https://example.com]]. |
| Moving a page without leaving a redirect | Unchecked "Leave a redirect behind" | Always keep this checked. Without it, all links to the old title become broken. |
| Redirect page shows in search results | No __NOINDEX__ on the redirect |
Add __NOINDEX__ to redirect pages that should not appear in search results. MediaWiki adds __NOINDEX__ automatically for some redirect types. |
| Multiple redirects target the same page and cause confusion | No standard redirect management | Create a redirect tracking category and review redirects periodically. Use Special:UnusedRedirects to find stale redirects. |
Practice Questions
- What happens when a user visits a double redirect, and how do you fix it?
- When would you use a soft redirect instead of a hard redirect?
- Write the exact syntax for creating a redirect from "DodaBrowser" to "DodaBrowser Pro" on a page called "DodaBrowser."
- Challenge: Simulate a wiki reorganization. Create 3 pages: "Apples," "Oranges," and "Fruits." Move "Apples" to "Apple Fruit" and "Oranges" to "Orange Fruit." Create "Fruits" as a soft redirect to the Wikipedia article on fruit. Check
Special:DoubleRedirectsand fix any issues. Create a fourth page "Fruit List" that links to all three fruit pages plus any redirects. Finally, useSpecial:WhatLinksHereto see which pages link to each redirect.
FAQ
Mini Project
Goal: Create and manage a redirect system for a wiki reorganization.
- Create 6 pages: "Product A," "Product B," "Product C," "Product D," "Product E," and "Product List"
- Rename "Product A" to "Product Alpha" using the Move action
- Rename "Product B" to "Product Beta" using the Move action
- Create a redirect from "Legacy Product" to "Product Alpha"
- Create "Product C Renamed" and set "Product C" as a redirect to it
- Visit
Special:DoubleRedirectsand ensure no double redirects exist - Create a soft redirect from "External Resource" to "https://dodatech.com"
- Create a template called
DeletedProductthat adds a soft redirect notice with an edit link - Use
Special:UnusedRedirectsto find any redirects no page links to - Document the redirect structure on the "Product List" page
What's Next
Redirects keep your wiki working even as it changes. Now let's look at categories — how to group related pages by topic.
Continue to Lesson 17: Categories — learn how to create category trees, sort pages within categories, and manage the category system.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro