R
R
Roman2022-04-01 03:11:44
Web development
Roman, 2022-04-01 03:11:44

How to change the Content-Type header in laravel when displaying a sitemap?

The site has it. sitemap

It consists of a индекса Sitemaplot of files with a list of links (each file has 50k links).

The sitemap index is placed in the public folder.

Accessing index by link: example.com/sitemap.xml
Accessing other files:

- example.com/sitemap/sitemap1.xml
- example.com/sitemap/sitemap2.xml

The file opens, but in the response header Content-Type: application/xml.
I need to change the Content-Type to a different response.
Can you tell me how to implement?

If I generated using laravel sitemap, then there would be no problems. Simply in Response registered the necessary heading.

But you need a direct link to display the sitemap index file and files with a list of links. How can the Content-Type be changed in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2022-04-01
@gagablik

Do it using the web server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question