Your IP will never redirect to your domain. Your domain will redirect to your IP, and this is not configured at the server. You need to create a CNAME entry with a DNS registrar. What have you tried so far?
Yes, but I’ll have to be more specific. The SO link talks about the Apache rewrite module, which would require you to connect to the server in order to work. It’s only a redirect from your own server, but it’s not the way to associate a domain name with a server, which is what I was assuming your goal was. Let’s take a step back.