<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3ARewrite_Philosophy</id>
	<title>ICT:Rewrite Philosophy - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mwiki.costasano.club/index.php?action=history&amp;feed=atom&amp;title=ICT%3ARewrite_Philosophy"/>
	<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:Rewrite_Philosophy&amp;action=history"/>
	<updated>2026-07-22T23:28:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://mwiki.costasano.club/index.php?title=ICT:Rewrite_Philosophy&amp;diff=16&amp;oldid=prev</id>
		<title>Mngr: Nieuwe pagina aangemaakt met &#039; = Rewrite Philosophy for MediaWiki =  MediaWiki is not a traditional website built from static files. It is a &#039;&#039;title‑driven application&#039;&#039; where almost every URL — even those that look like files — must be routed through &lt;code&gt;index.php&lt;/code&gt;.   This page explains the philosophy behind the Apache rewrite rules used on this server, so future administrators understand &#039;&#039;why&#039;&#039; the rules exist and &#039;&#039;what&#039;&#039; they protect.  == 1. MediaWiki routes titles, not…&#039;</title>
		<link rel="alternate" type="text/html" href="https://mwiki.costasano.club/index.php?title=ICT:Rewrite_Philosophy&amp;diff=16&amp;oldid=prev"/>
		<updated>2025-12-27T16:39:34Z</updated>

		<summary type="html">&lt;p&gt;Nieuwe pagina aangemaakt met &amp;#039; = Rewrite Philosophy for MediaWiki =  MediaWiki is not a traditional website built from static files. It is a &amp;#039;&amp;#039;title‑driven application&amp;#039;&amp;#039; where almost every URL — even those that look like files — must be routed through &amp;lt;code&amp;gt;index.php&amp;lt;/code&amp;gt;.   This page explains the philosophy behind the Apache rewrite rules used on this server, so future administrators understand &amp;#039;&amp;#039;why&amp;#039;&amp;#039; the rules exist and &amp;#039;&amp;#039;what&amp;#039;&amp;#039; they protect.  == 1. MediaWiki routes titles, not…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
= Rewrite Philosophy for MediaWiki =&lt;br /&gt;
&lt;br /&gt;
MediaWiki is not a traditional website built from static files. It is a &amp;#039;&amp;#039;title‑driven application&amp;#039;&amp;#039; where almost every URL — even those that look like files — must be routed through &amp;lt;code&amp;gt;index.php&amp;lt;/code&amp;gt;.  &lt;br /&gt;
This page explains the philosophy behind the Apache rewrite rules used on this server, so future administrators understand &amp;#039;&amp;#039;why&amp;#039;&amp;#039; the rules exist and &amp;#039;&amp;#039;what&amp;#039;&amp;#039; they protect.&lt;br /&gt;
&lt;br /&gt;
== 1. MediaWiki routes titles, not files ==&lt;br /&gt;
&lt;br /&gt;
A URL such as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/Bestand:2017-1712.jpg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; a real file.  &lt;br /&gt;
It is a &amp;#039;&amp;#039;page title&amp;#039;&amp;#039; that happens to contain a colon and end with &amp;lt;code&amp;gt;.jpg&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If Apache treats this as a static file, MediaWiki never receives the request.  &lt;br /&gt;
This breaks:&lt;br /&gt;
&lt;br /&gt;
* file description pages  &lt;br /&gt;
* thumbnail generation  &lt;br /&gt;
* metadata extraction  &lt;br /&gt;
* upload history  &lt;br /&gt;
* namespace routing  &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Therefore: namespace titles must always be routed to MediaWiki.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== 2. Static files must be served directly — but only real ones ==&lt;br /&gt;
&lt;br /&gt;
MediaWiki has real static assets:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;/resources/&amp;lt;/code&amp;gt;  &lt;br /&gt;
* &amp;lt;code&amp;gt;/skins/&amp;lt;/code&amp;gt;  &lt;br /&gt;
* &amp;lt;code&amp;gt;/images/&amp;lt;/code&amp;gt;  &lt;br /&gt;
* &amp;lt;code&amp;gt;/favicon.ico&amp;lt;/code&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
These should bypass PHP for performance.&lt;br /&gt;
&lt;br /&gt;
However, only &amp;#039;&amp;#039;&amp;#039;actual files&amp;#039;&amp;#039;&amp;#039; should bypass PHP — not titles that merely &amp;#039;&amp;#039;look&amp;#039;&amp;#039; like files.&lt;br /&gt;
&lt;br /&gt;
This is why the rewrite rules include a safeguard to prevent namespace titles from being mistaken for static files.&lt;br /&gt;
&lt;br /&gt;
== 3. Namespaces always contain a colon ==&lt;br /&gt;
&lt;br /&gt;
This is the key principle.&lt;br /&gt;
&lt;br /&gt;
Every namespace title follows the pattern:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/Namespace:Page&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;Bestand:&amp;lt;/code&amp;gt;  &lt;br /&gt;
* &amp;lt;code&amp;gt;File:&amp;lt;/code&amp;gt;  &lt;br /&gt;
* &amp;lt;code&amp;gt;Media:&amp;lt;/code&amp;gt;  &lt;br /&gt;
* &amp;lt;code&amp;gt;Research:&amp;lt;/code&amp;gt;  &lt;br /&gt;
* &amp;lt;code&amp;gt;ICT:&amp;lt;/code&amp;gt;  &lt;br /&gt;
* any future namespace  &lt;br /&gt;
* any language alias  &lt;br /&gt;
&lt;br /&gt;
Because of this, the rewrite rules include:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
RewriteCond %{REQUEST_URI} !^/[^/]+:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ensures that &amp;#039;&amp;#039;&amp;#039;any URL containing a namespace prefix is routed to MediaWiki&amp;#039;&amp;#039;&amp;#039;, even if it ends with &amp;lt;code&amp;gt;.jpg&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.png&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.css&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;.js&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This rule is future‑proof and protects all namespaces automatically.&lt;br /&gt;
&lt;br /&gt;
== 4. Everything else is rewritten to MediaWiki ==&lt;br /&gt;
&lt;br /&gt;
After excluding:&lt;br /&gt;
&lt;br /&gt;
* API entry points  &lt;br /&gt;
* static assets  &lt;br /&gt;
* real files  &lt;br /&gt;
* MediaWiki’s own image storage  &lt;br /&gt;
&lt;br /&gt;
…all remaining URLs are rewritten to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/index.php?title=$1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This ensures MediaWiki handles:&lt;br /&gt;
&lt;br /&gt;
* pages  &lt;br /&gt;
* categories  &lt;br /&gt;
* files  &lt;br /&gt;
* templates  &lt;br /&gt;
* modules  &lt;br /&gt;
* custom namespaces  &lt;br /&gt;
* extensions  &lt;br /&gt;
&lt;br /&gt;
This is the core of MediaWiki’s routing model.&lt;br /&gt;
&lt;br /&gt;
== 5. Why this philosophy matters ==&lt;br /&gt;
&lt;br /&gt;
Rewrite rules are powerful but fragile.  &lt;br /&gt;
A single misplaced rule can silently break:&lt;br /&gt;
&lt;br /&gt;
* file pages  &lt;br /&gt;
* thumbnails  &lt;br /&gt;
* namespaces  &lt;br /&gt;
* extensions  &lt;br /&gt;
* VisualEditor  &lt;br /&gt;
* REST endpoints  &lt;br /&gt;
&lt;br /&gt;
Documenting the &amp;#039;&amp;#039;intent&amp;#039;&amp;#039; behind the rules ensures that:&lt;br /&gt;
&lt;br /&gt;
* future administrators understand the logic  &lt;br /&gt;
* upgrades do not break routing  &lt;br /&gt;
* debugging is easier  &lt;br /&gt;
* the configuration remains stable over time  &lt;br /&gt;
&lt;br /&gt;
This philosophy is part of the long‑term stewardship of the system.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Rewrite only real static files.  &lt;br /&gt;
Route everything else — especially anything with a namespace — through MediaWiki.&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>Mngr</name></author>
	</entry>
</feed>