Task: convert the query string from http://anything.example.com/querystring to http://example.com/anything/querystring
And I also need to convert some querystring in the following way: nikon/123/something => ?section=nikon&id=123 , and leave the remaining strings unchanged.
In part, everything works for me with this htaccess:
RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)\.example\.com [NC] RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ %1/index.php?section=$1&id=$2 [L,QSA] But this only works for queries matching the pattern in the third line. Those. if I place, for example, sitemap.xml in the folder www/anything/sitemap.xml , then I can not request it by the URL anything.example.com/sitemap.xml - displayed Not found
I have more templates, I don’t specifically list them here so as not to clutter the issue with excess.
I would also add that I never managed to make a separate template for sitemaps. It did not work ...