Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect my sub.my-domain.com to discord

I've been looking for a method with DNS to redirect my domain's subdomain e.g http://server.my-domain.com to https://discordapp.com/invite/server

like image 795
Daryan Avatar asked Oct 23 '25 19:10

Daryan


2 Answers

As i found the answer of this question, i'd love to share it with all of you,

  1. Create a CNAME on your domain named server: (or any other name you want)
  2. Target the CNAME to: discord.gg.opts-slash.INVITECODE.redirect.center but change the INVITECODE to your server invite code
  3. Save it and you are good to go!

Please note that: If you want to use it for another method other than discord please remember:

.opts-slash means / for example you have http://example.com/123, to redirect your http://example.my-domain.com/ to http://example.com/123 type in the CNAME example.com.opts-slash.123.redirect.center and your CNAME name to example.

like image 123
Daryan Avatar answered Oct 25 '25 22:10

Daryan


As i couldn't get it to work redirecting it directly through a CNAME, i had success by creating a simple netlify app which is just redirecting via JS:

  1. Create index.html with the following content:

<html>

<head>
  <title>Discord redirect</title>
</head>

<body>
  <script>
    window.location.replace("https://discord.com/invite/INVITECODE");
  </script>
</body>

</html>
  1. Place the index.html inside a folder and upload it to netlify
  2. You'll get a unique name, such as eloquent-noyce-x00xx0
  3. Set a CNAME to your app with eloquent-noyce-x00xx0.netlify.app. (last dot is important!)
  4. Set your mydiscord.mydomain.com as custom domain in netlify
  5. That's it, visit mydiscord.mydomain.com and it'll redirect you
like image 22
wSkc Avatar answered Oct 25 '25 22:10

wSkc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!