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

Oct 6, 2014929Alex 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():

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

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

For Prestashop SEO module please check this page:

Partner With Us Looking for a partner that will help you to grow your business? We are the right company to develop your webstore. Feel free to get in touch with us. We will be happy to discuss your business opportunities and provide you with a Free Quote. Talk to Igor


  1. 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?

  2. 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.

  3. Hi Alex,

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

  4. 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?

Post a new comment

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