OpenCart - Create sitemap.xml on the fly (each time) or save it to disk and cache it?

kanenas picture kanenas · Jan 25, 2015 · Viewed 7.8k times · Source

I run an e-Shop with OpenCart v.1.5.6.5_rc.

I use OpenCart's: Extensions -> Product Feeds -> sitemap.xml

The e-Shop has about 1500 products and 80 categories. New products are added once a day and sometimes once every two or three days.

Is it a good practice to generate sitemap.xml on the fly every time is needed or it would be better to create it once a day (with schedule) and cache it?

Thank you!

Answer

Jay Gilford picture Jay Gilford · Jan 26, 2015

The link to www.yoursite.com/sitemap.xml actually generates a sitemap in realtime. The sitemap.xml file does not exist and is simply rewritten via a .htaccess rewrite rule to the feed. Here's the line

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]