2

I would like to make nginx serve sitemap and robots. My problem is that route http://example.com/ is handled by flask, configured to handle request with certain patterns - http://example.com/sitemap.xml would result in error 404.

I also posted this question in stackoverflow: [https://stackoverflow.com/questions/36024790/serving-sitemap-from-nginx-when-flask-routing-at-root].

I thought it may be more relevant to webmasters because answers to similar questions in SO suggest to make flask serve static files, rather than make sitemaps be served directly from server (as commented here at last comment: [https://stackoverflow.com/a/4241389/305883]).

My sitemap is a site_map_index, and would like to organise all types of sitemaps__progressive_digit_number.xml files into a folder:

/var/www/example.com/sitemaps/*.xml

and make nginx serve sitemap as:

http://example.com/sitemap.xml

(and not http://example.com/sitemap/sitemap.xml, since sitemaps files include links global to the site).

How could I override the routing of my web app (here made in flask)?

In [https://stackoverflow.com/questions/36024790/serving-sitemap-from-nginx-when-flask-routing-at-root] I attempted a configuration with location directive with no success.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.