I know you can't put a port in /etc/hosts, so how can I achieve the equivalent of:     https://website.com:4433

For WordPress, I need CURL to go to on port 4433. As it's wordpress and not a script I made, I can't change that.


I managed to find the iptables rule to fix my issue:

iptables -A OUTPUT -d -p tcp -j DNAT --to-destination
  • 1
    This doesn't show any 'website.com' information. – Run Jul 9 at 2:43

Add a line into your /etc/hosts:      website.com

then configure your program (whatever it is) to listen on 4433 at

And you're done.


echo hi | nc -lt 4433

now open website.com:4433 and you should see a "hi".

to fix the problem you mentioned in the comments you can use socat:

socat tcp-listen:4433,reuseaddr,fork tcp:localhost:xx

with the above command, socat will listen on 4433 and whenever a request came in in will forward it to the xx, so change the xx with the real port where your program is listening to.

  • I can't tell the program to listen on 4433 – NerdOfLinux Jul 13 '17 at 16:08
  • why can't you tell curl to listen to port 4433? – Rinzwind Jul 13 '17 at 16:09
  • It's part of wordpress. I have a problem with WP-cron and I need it to redirect my domain name to localhost. – NerdOfLinux Jul 13 '17 at 16:10
  • That's another question however I'll update my answer ;) – Ravexina Jul 13 '17 at 16:14
  • Is there an iptables rule to redirect localhost requests to port 443 to port 4433? – NerdOfLinux Jul 13 '17 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.