TLDR; No, you cannot redirect HTTP to HTTPS at the DNS level. This is something you have to configure on your web server (because it manages the protocol). If you don't have access to your web server, you will need to contact your web hosting provider.
No, what you ask is not possible. DNS is name resolution system and knows nothing about HTTP.
if you use AWS, a redirect like
mail.foo.com --> mail.google.com/a/foo.com
can be setup as follows:
not a pure DNS solution, but it works ;)
But be aware of, the redirect skips all the URL parameters e.g.: ...?param1=value1¶m2=value2
I realize this is an old thread but FWIW, incase someone else is looking for a way to do this.
While dns does not understand the path portion of the url, it will understand subdomains, so instead of:
www.proof.com IN CNAME www.proof-two.com/path/index.htm
You could use:
www.proof.com IN CNAME proof.proof-two.com
then go to wherever you host proof-two.com and set it to point proof.proof-two.com to www.proof-two.com/path/index.htm.
~ there's always more than one way to skin a cat
I have a personal project that might help you in solving this issue. It's an open source redirect solution that allows you to redirect your domain just changing your DNS settings. Link of the project: https://redirect.center/.
To redirect www.proof.com to www.proof-two.com keeping the URL parameters, just set your www DNS entry on proof.com:
www.proof.com IN CNAME www.proof-two.com.opts-uri.redirect.center.
It seems that it's my provider (OVH) who allows that kind of redirect within its infrastructure.
See : https://docs.ovh.com/gb/en/domains/redirect-domain-name/
I'm keeping the answer below for the sake of archiving, but it doesn't provide any meaningful information for other DNS providers.
I did that using a TXT record.
To redirect foo.bar.com
to foo2.bar.com/path
, just add foo IN TXT "1|foo2.bar.com/path"
in your bar.com
DNS zone.
It also keeps the url paths and parameters. So if you try to access foo.bar.com/hello?foo=bar
, you'll be redirected to foo2.bar.com/path/hello?foo=bar
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With