How do I redirect traffic only if being accessed from a specific port?

How do I redirect traffic only if being accessed from a specific port? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the How do I redirect traffic only if being accessed from a specific port? error on your web browser. Problem :


My website, https://coolkids.gq, has a Minecraft server hosted on it as well as a web server. It hosts both Bedrock and Java versions of Minecraft (unrelated) and I’ve figured out how to do the Java side but I’m still stuck on the bedrock side as it doesn’t allow SRV records.


I want to be able to access both the webpage and the Minecraft server at https://coolkids.gq. The Minecraft server uses port 19132 and the website uses ports 80 and 443 obviously.


When I go to HTTP or HTTPS ports it should take me to the main website, but when I use 19132 it will redirect me to another link that hosts the server, e.g. myamazingserver.net. It would be preferred if it redirected to myamazingserver.net:19132 but just myamazingserver.net should work as well.


How, by using .htaccess, HTML, PHP or DNS could I achieve this?


Edit: Bedrock Edition does not support SRV.


Solution :

Although Patrick is correct in saying that web browsers do not support SRV records, Minecraft does support them, so there's no need for a reverse proxy setup.



According to this NameCheap tutorial, you'll need to create an SRV record with the following info:




Service: _minecraft



Protocol: _tcp



Priority: 0



Weight: 5



Port: [custom port]



Target: [your domain]




The record needed for other domain registrars should be very similar.



After this is set up, you'll still be able to access your website at https://coolkids.gq, but you'll also be able to access your Minecraft server at coolkids.gq (note the lack of https:// since Minecraft afaik has no URI scheme).


We hope that this article has helped you resolve the htaccess, redirects, dns error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

Redirected urls show in serp, with the original permalink but with the title and meta of the target page

How can I redirect everything but the index as 410?