I would like to know if it would be an issue to use this code in a production environment:
RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-zA-Z0-9_-]+)\.(?:com|co\.uk|es|de)$
RewriteCond $1 ^sitemap([0-9]+)?\.xml(\.gz)?$
RewriteRule ^(.*)$ /files/%{HTTP_HOST}/$1 [L,QSA]
Basically, I have hundreds of domains pointing to the same home directory on a server. I would like to move all the sitemaps for each site to a different folder (so example1.com can not access example2.com's sitemap!)
First of all, I can not hard-code all the domains in a "white-list" as we are talking about hundreds of them and adding more weekly.
The plan is to basically redirect any requests for sitemap.xml/sitemap2.xml/sitemap.xml.gz to the domains' folder.
So for instance:
example1.com will have it's real sitemap.xml file in /files/example1.com/sitemap.xml
example2.com will have it's real sitemap.xml file in /files/example2.com/sitemap.xml
My question, is if it is a possible issue to use HTTP_HOST in a RewriteRule, as I know that it can indeed be an issue if you do not filter it in PHP for example, if you do a redirect using HTTP_HOST as the user can manipulate it.
Thank you!