arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redirect link
#3
It can be done via the firewall without any changes to the web server.

iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports <new port here>

Try the rule above. Don't forget to change the <new port here> part to the port that you want to redirect to.

An alternative:
iptables -t nat -I PREROUTING --src 0/0 --dst <your server ip> -p tcp --dport 80 -j REDIRECT --to-ports <new port here>

Here again make sure you adjust <new port here> and also <your server ip>.

If the server is OpenVZ and doesn't have the NAT iptables modules loaded on the hostnode the commands might fail. In that case you might have to build a vHost on port 80 that redirects to the other port. For that take a look at this: https://stackoverflow.com/a/13089668


My references for the iptable rules:
- https://www.cyberciti.biz/faq/linux-port...-iptables/
- https://wiki.debian.org/Firewalls-local-...edirection


P.S.: "throw"? You mean "to". Throw means absolutely something different.
[Image: zHHqO5Q.png]
lockThread Closed 


Messages In This Thread
Redirect link - by Melvin - 06-06-2019, 12:07 AM
RE: Redirect link - by tiwil - 06-06-2019, 01:34 AM
RE: Redirect link - by Mashiro - 06-06-2019, 05:39 AM
RE: Redirect link - by Melvin - 06-06-2019, 07:48 AM
RE: Redirect link - by humanpuff69 - 06-06-2019, 10:27 AM
RE: Redirect link - by Melvin - 06-06-2019, 10:57 AM
RE: Redirect link - by Mashiro - 06-06-2019, 10:57 AM

Possibly Related Threads…
Thread
Author
Replies
Views
Last Post

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting