how to set the htaccess 301 redirect from the site ip address to the domainofsite.com?

Hi,

How does one set the htaccess 301 redirect from the site ip address to the domainofsite.com?

I am getting this error: see attached.

Thanks...