Ps. I use Namecheap, and when I just tried to set a redirection from domain2.com → domain2.com/page, they told me that because I set my DNS records to Webflow I should do further redirections in Webflow.
The exact scenario you’ve described is not directly supported.
Here are the closest options.
Handle the redirects externally, e.g. at Namecheap, or a more versatile DNS like Cloudflare, you can control exactly what redirects where. You’d remove domain2 from Webflow and then setup the redirects you need via domain1 - however domain 1 will show, e.g. domain2.com will redirect to domain1.com/page
You could do javascript, where your homepage watches for requests to domain2.com and redirects - however users will see a flash and redirect.
Webflow’s redirect feature won’t work for you because it will affect all domains.
You might be able to do it with a reverse proxy setup, but that’s quite a technical approach. Search the forums for more details on that.
hi Michael, thanks for the answer. do you know how I could do that javascript you mentioned? so that the homepage would specifically watch the request to domain2.com and redirect users? because on Webflow the home page is the same for all the domains, but it means that when users try to access domain.com they would remain there, but if users enter domain2.com then the javascript would see that and fire up?
You can use the window.location object in JavaScript to get the current URL of the page and then use conditional statements to redirect the user to a different page based on the domain.
Example;
// Get the current URL
const currentUrl = window.location.href;
// Check if the domain is "example.com"
if (currentUrl.includes("example.com")) {
// Redirect to a child page of "example.com"
window.location.href = "https://example.com/child-page";
}