I’m making a dynamic sitemap and i want it gziped before output. How do I do that? What header should I add?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On this page two methods for sending gzipped output are outlined.
The easiest solution is to use output buffering with the ob_gzhandler:
The ob_gzhandler will take care of setting the correct headers. It also does not gzip the data in case the client does not support gzip encoding.
However, the ob_gzhandler requires that the Zlib library is enabled. For more details see the documentation of ob_gzhandler.