Search code examples
dnsurl-routinghttp-redirectcloudflare

URL Redirection to another domain with same query parameters


I bought two domains and I want my users to get redirected when they try to visit www.mydomain1.com/somepath?somequery to www.mydomain2.com/somepath?somequery. Is it possible using just some service like Cloudflare and not having a dedicated hosting service per se for mydomain1.com because the sole purpose of mydomain1.com is to redirect to mydomain2.com and not to serve any webpage at all?


Solution

  • You can do it using Cloudflare Page Rules. Just add mydomain1.com in your Cloudflare account and create a page rule for URL forwarding with inputs as from:http://www.mydomain1.com/* to:http://www.mydomain2.com/$1