MediaWiki setup notes: Difference between revisions
From Joomla! Documentation
m →Page redirections: clean up |
m Marked for translation |
||
| Line 1: | Line 1: | ||
<noinclude><languages /></noinclude> | |||
<translate> | |||
These are some notes about setting up a MediaWiki for use by the Documentation Working Group. | These are some notes about setting up a MediaWiki for use by the Documentation Working Group. | ||
</translate> | |||
<translate> | |||
==mod_rewrite rules for this wiki== | ==mod_rewrite rules for this wiki== | ||
Invaluable information [http://www.mediawiki.org/wiki/Manual:Short_URL/Page_title_--_PHP_as_a_CGI_module%2C_no_root_access here]. | Invaluable information [http://www.mediawiki.org/wiki/Manual:Short_URL/Page_title_--_PHP_as_a_CGI_module%2C_no_root_access here]. To begin with we have these rewrite rules in place: | ||
</translate> | |||
<pre> | <pre> | ||
RewriteEngine On | RewriteEngine On | ||
| Line 10: | Line 17: | ||
RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA] | RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA] | ||
</pre> | </pre> | ||
<translate> | |||
However, because we have some pages which have dots in their titles (and hence their URLs), we had to apply the following rewrite rules: | However, because we have some pages which have dots in their titles (and hence their URLs), we had to apply the following rewrite rules: | ||
</translate> | |||
<pre> | <pre> | ||
| Line 29: | Line 39: | ||
</pre> | </pre> | ||
<translate> | |||
==Page redirections== | ==Page redirections== | ||
In the default MediaWiki installation it is possible to redirect from one page to another by including <nowiki>#REDIRECT [[page-to-redirect-to]]</nowiki> at the very top of a page. However, this does not alter the URL shown in the browser address bar and so could lead search engines to consider it as duplicate content. A simple fix has been applied to this wiki so that redirects are done by the browser by having the wiki send out an HTTP 302 redirect status code. The fix applied is [http://meta.wikimedia.org/wiki/Help:Redirect Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)] | In the default MediaWiki installation it is possible to redirect from one page to another by including <nowiki>#REDIRECT [[page-to-redirect-to]]</nowiki> at the very top of a page. However, this does not alter the URL shown in the browser address bar and so could lead search engines to consider it as duplicate content. A simple fix has been applied to this wiki so that redirects are done by the browser by having the wiki send out an HTTP 302 redirect status code. The fix applied is [http://meta.wikimedia.org/wiki/Help:Redirect Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)] | ||
<noinclude>[[Category:Documentation Wiki Information]]</noinclude> | </translate> | ||
<noinclude><translate> | |||
[[Category:Documentation Wiki Information]] | |||
</translate></noinclude> | |||
Revision as of 12:11, 2 January 2015
These are some notes about setting up a MediaWiki for use by the Documentation Working Group.
mod_rewrite rules for this wiki
Invaluable information here. To begin with we have these rewrite rules in place:
RewriteEngine On RewriteRule ^[^:]*\. - [L] RewriteRule ^[^:]*\/ - [L] RewriteRule ^/*$ /wiki/index.php?title=Main_Page [L,QSA] RewriteRule ^(.+)$ /wiki/index.php?title=$1 [L,QSA]
However, because we have some pages which have dots in their titles (and hence their URLs), we had to apply the following rewrite rules:
RewriteEngine on
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^(.+) /path/to/web/directory/$1 [L]
# redirect to main page
RewriteRule ^/*$ /index.php?title=Main_Page [L,QSA]
# anything else is to be treated as a title
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]
Page redirections
In the default MediaWiki installation it is possible to redirect from one page to another by including #REDIRECT [[page-to-redirect-to]] at the very top of a page. However, this does not alter the URL shown in the browser address bar and so could lead search engines to consider it as duplicate content. A simple fix has been applied to this wiki so that redirects are done by the browser by having the wiki send out an HTTP 302 redirect status code. The fix applied is Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)