Reputation: 3920
I have the following content in my robots.txt file:
Sitemap: https://example.com/sitemap.php
Is it ok to have the sitemap
in robots.txt as .php
file instead of .xml
as I generate it dynamically?
Upvotes: 1
Views: 1018
Reputation: 96737
A consumer (like a search engine bot) can’t know if a file is static or dynamically generated, it could only guess (e.g., based on the response time, HTTP response headers, or the URL design).
You could have a static file named sitemap.php
, and you could have a dynamically generated file named sitemap.xml
.
And a consumer doesn’t need to know. What matters is the content of the file, not how the file was/is created, not its URL.
In any case, make sure to send the correct Content-Type
for this file. Some servers automatically select a content type based on the filename extension, which would fail with .php
, so you might have to set it explicitly.
Upvotes: 2