Jump to content
  • 0

Generate sitemaps containing the non-www versions of the URLs


Guest Biolo Gic

Question

Guest Biolo Gic

I usually prefer the non-www URL for my website (http://example.com, not http://www.example.com). While submitting the site to Google one needs to set a preferred domain by choosing either the www or the non-www version of URL. Then, during submitting the sitemap, only the sitemap containing the preferred version of URL should be submitted to Google search console.

I have a website run by MediaWiki software. It uses a PHP script (named generateSitemap.php, it is bundled with the MediaWiki installation package) to create the sitemaps. One can set cron jobs to automate the process of updating sitemap at regular intervals.

The problem is my sitemaps are being generated containing the www version of the webpages.

How should I instruct the programs to generate sitemaps without www in the URLs? Please help.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

According to the MediaWiki.org manual page for generateSitemaps.php, the script has an option named --urlpath  (which you should apparently use almost always with the --server option), which allows setting an absolute URL and seems to have been specifically implemented to support Google's requirements for sitemaps.

Edited by Jack Phoenix
typofix (see edit history)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.