Extension:VisualEditor/Apache rewrite rules for short URLs

This documentation per task T270376 applies to the VisualEditor shipped with MediaWiki 1.35 and later in connection with the Apache webserver. Earlier versions work with the standard rewrite rules for short URLs .

Nginx webserver does not appear to be affected. Usual short URL configuation applies.

Examples

edit

These examples assume that you installed you wiki in the following directory ../path/to/documentroot/w/... Change the /w/ in the examples below to the directory you use for your wiki. If you installed your wiki in document root you can drop the /w/.

Standard short URL

edit

Example URL: "https://wiki.example.org/page/Page_title"

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^/?page(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
    RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]
</IfModule>

The rewrite rules are no different to what you would usually do in this case. If you do not use page as the path change it to the path you use for your wiki.

Non-standard short URL

edit

Example URL: "https://wiki.example.org/Page_title"

<IfModule mod_rewrite.c>
    RewriteEngine on
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
	RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
	RewriteRule ^(?:(?!rest.php/).)*$ %{DOCUMENT_ROOT}/w/index.php [L]
	RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
</IfModule>

See also

edit