Thoughts, information and reflections about technology

Redirecting a Joomla OSMap sitemap to /sitemap.xml

I have been changing the sitemap generator for my Joomla sites from XMap to OSMap.

Several of the SEO tools were complaining that they could not find sitemap.xml.

One way to rectify this would be to include a sitemap line in the robots,txt file such as

sitemap: /index.php?option=com_osmap&view=xml&tmpl=component&id=3

NOTE – the id number will vary depending on how many sitemaps you set up.

The other way to handle it is to create a rewrite rule in your .htaccess file to redirect sitemap.xml to the OSMap xml sitemap.

The first thing to do is to get the URL of the sitemap. Go to Components OSMap and click on the XML link for the sitemap you want. The sitemap will open in a new tab.

Then go to the .htaccess file. Look for the lines :

## Begin – Custom redirects
#

## End – Custom redirects

Put the following lines before the ##End line. Of course substitute your site name and make sure you are using the proper id.

RewriteCond %{REQUEST_URI} ^/sitemap.xml
RewriteRule .* http://www.example.com/index.php?option=com_osmap&view=xml&tmpl=component&id=3

Note . There are a number of examples of this throughout the web. However, we did not see any using the full URL in the RewriteRule. most were in the format of

RewriteRule .* index.php?option=com_osmap&view=xml&tmpl=component&id=3

The rewrite was not working until I used the full URL.

Once the rewrite rule is in place, any search engines looking for /sitemap.xml will find the correct sitemap. If you change the OSMap sitemaps, you might need to check the id of the OSmap xml sitemap and adjust the .htacess file accordingly.

Similar Posts:

3 Responses to Redirecting a Joomla OSMap sitemap to /sitemap.xml

  • Thanks for the info. What would be the approach if you don't want the URI redirected, just load the component file in place of the XML?

  • Many thanks, I've been looking for ways to redirect your site. The site is built on the basis of the template joomla. And you need to do redirection on the xml thank you page. I hope using your recommendations I will be able to make a workable page.

  • Great post,
    couldnt get it to work for some reason, but your idea inspired me to try and use the built in Joomla Redirect Component.
    Components->Redirect->new
    Source URL: /sitemap.xml
    Destination URL: /index.php?option=com_osmap&view=xml&id=1

    Save.
    All done, sitemap.xml now resolves to the OSMap xml page.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact me
Archives
Categories
Recent Comments