Create a Custom Magento XML Sitemap with PHP | Revital Agency
Skip to main content

Create a Custom Magento XML Sitemap with PHP

The built-in option for Magento simply takes all the products and makes the sitemap. Which will work for 95% of the stores out there. But if your working on a really custom shop you might want to create your own. This one shop I’m working on has all Configurable Products so I do not want the simple products showing in my sitemap.

I also want to turn off categories like “featured” that I use for sliders and such.

  1. Create File to Overwrite

    Create a file called “my_sitemap.xml” in your root.

  2. Download Script

    You can download the freshest code from our GitHub Gist.

  3. Change Site Source

    Enter in the Base Variable

  4. Run.

    Make sure your Flat File Index is updated in the Magento Admin. Then, either run it manually when you make a change or set up a cron job.