Allow rewrite for hostname/domain (not only paths)
It would be great to have the ability to redirect multiple domains to the same project.
I tried to achieve this with regular expression redirect, but it doesn't work:
{
"regex": "https:\\/\\/.*?(?P<hostname>\\w+\\.[a-z]+)\\/",
"destination": "/:hostname/index.html"
}
For example with domains one.com and two.com, I want to be able to redirect them to the same project but different subfolders (e.g. /one.com/index.html, /two.com/index.html) -- this will allow to share common resources (styles, images, etc) between the projects, while still being able to customize the content for each one.
-
Ignat Ignatov commented
It will be much simpler and more elegant, if it was possible to just execute the rewrite on domain instead.
-
Ignat Ignatov commented
I managed to achieve something working with multiple hosting targets, but it requires too much additional setup -- i.e. add multiple sites, configure domain per site, add script to copy common/shared assets to subfolders, etc. And it's not possible to share hosting configuration as well, it needs to be copy-pasted for each target, which leads to a big configuration file. Since the file is in JSON format, there's no way to reuse the common parts.