Thread:Manual talk:FAQ/Corrected code and text.

Changes made:
 * Use example.com see RFC 2602.
 * Improved code logic and efficiency.
 * Added escaping.
 * Changed from 302 to 301 redirect.
 * Added L flag.
 * Changed wording from "rewrite" to "redirect".
 * Mass redirects to root are a 'signal of low technical quality' as far as searchengines are *concerned. Preserved page name in the redirect.

Replacement wording for section:

After hiding all the appropriate links (see above), if you are using the Apache web server, you can disable actions and special pages using the following rewrite rules:


 * 1) Lock down the site (disable MediaWiki commands)

RewriteEngine On


 * 1) RewriteLog /tmp/rewrite.log


 * 1) RewriteLogLevel 9


 * 1) See http://www.mediawiki.org/wiki/Manual:Parameters_to_index.php#Actions

RewriteCond %{QUERY_STRING} (^|&)action=(&|$) RewriteRule (.*) http://www.example.com/$1? [R=301,L]

RewriteCond %{REQUEST_URI} Special: RewriteCond %{REQUEST_URI} !^/index\.php/Special:Search RewriteRule (.*) http://www.example.com/$1? [R=301,L]

RewriteCond %{QUERY_STRING} Special: RewriteRule (.*) http://www.example.com/? [R=301,L]
 * 1) Catch a trick...

Above, a request for, for example, will be simply redirected to. Similarly any page in the Special namespace (with the exception of Special:Search) will be redirected to. Remember, this is only a hack, and isn't intended as a solution for a secure CMS.