How redirect from IP to domain? (Apache)

Hi. If someone go to my IP adress, how redirect them to my domain.
I’ve tried add rewriterule to .htaccess but it’s not working.
Is there any different way to achieve that?

Because google shows in search results my IP adress instead of domain name. In other search engines I don’t have that problem.

You will have place the redirect rule in webserver using rewrite rules.

1 Like