Jump to: navigation, search

Other languages:
català • ‎Deutsch • ‎English • ‎español • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎Nederlands • ‎polski • ‎português • ‎português do Brasil • ‎русский • ‎中文


generateSitemap.php file is a maintenance script to generate a sitemap for a MediaWiki installation. Sitemaps are files that make it more efficient for search engine robots (like googlebot) to crawl a website (so long as the bot supports the sitemap protocol.)

By default, the script generates a sitemap index file and one gzip-compressed sitemap for each namespace that has content. See #Options for a list of options that can be passed to the script.

You may need to set up a cron job to update the sitemap automatically.

For generic instructions on using MediaWiki's maintenance scripts, see Manual:Maintenance scriptsManual:Maintenance scripts.



displays the available options for generateSitemap.php


The file system path to save to, e.g sitemap/. Note, this directory must be viewable online!


What site identifier to use for the wiki, defaults to $wgDBnameManual:$wgDBname


The URL that points to --fspath, e.g.
If specified, gets prefixed to the filenames in the sitemap index. This is needed because some search engines *cough*Google*cough* require absolute URLs in sitemaps. You should specify --server also; the values will often be similar, but having them separate allows the script to accommodate even unusual setups.


The protocol and host name to use in URLs, e.g.
This is sometimes necessary because server name detection may fail in command line scripts and will show up only as "localhost" or "my.servername" in the xml files.


Whether or not to compress the sitemap files. The default setting is yes.


If this option is added redirects are skipped and thus not listed within the sitemap. This is recommended since Google can complain about redirects. However the default setting is not to skip redirects.


Creating a sitemap for Google Webmaster Tools:

First (in $IP, i.e. document root which is where your "LocalSettings.php" file is located):

mkdir sitemap


php maintenance/generateSitemap.php --memory-limit=50M --fspath=/path/to/examplecom/sitemap/ --identifier=examplecom --urlpath= --server= --compress=yes

This example assumes that $wgScriptPath is set to '/w'. Non-latin domains need use Punycode.

Related configuration parameters[edit]

MediaWiki version: 1.13

MediaWiki version: 1.19