Get Free Audit

How to Include Custom Sitemap.xml in Robots.txt File in Prestashop

Oct 6, 2014

4679 Alex Simonchik

How to Include Custom Sitemap.xml in Robots.txt File in Prestashop

The function AdminMetaController::generateRobotsFile() is responsible for generating the robots.txt file in Prestashop. This function is executed via PREFERENCES -> SEO & URLS -> Generate robots.txt file.

But in one of our projects we faced the following issue: the sitemap.xml file is generated by the default Gsitemap module, which saves the file under the name  {shop_id}_index_sitemap.xml. But the function AdminMetaController::generateRobotsFile() uses the following code to find sitemap:

This means that the function is checking exactly for the file with the name sitemap.xml and includes it into robots.txt. But our file has a different name (1_index_sitemap.xml), that is why search engines are not able to find it.

To fix this, we created override/controllers/admin/AdminMetaController.php of the function generateRobotsFile():

Vlad Yunusov
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Vlad

This way Prestashop will be able to find and work with the sitemap file.

For Prestashop modules please check this page:

Vlad Yunusov
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Vlad


  1. I cannot find AdminMetaController.php under override/controllers/admin. In the folder admin only got index.php and templates. What should i do? My google webmaster tool only show 1 index page. How i can solve this?

  2. Hi Alex,

    Thanks for the post. Very usefull.
    Honestly, i don’t understand at all how can Prestashop have this kind of errors.

  3. Dean Dolić,

    I saw this bug only in Prestashop 1.6, but if you have similar problems in other versions you can try this method.

  4. Hi,

    I’m not sure, but is this bug present in all major PS releases including 1.6?

    We have our store still on so I wonder if I should apply this fix?

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *