What is the best practice for redirecting the IP address of a web server when it hosts multiple domain names?

The answer is in the comment:

Hosting companies that offer shared accounts typically have a number of sites hosted all on the same IP address using virtual hosts as you've done.. They point the IP address either to a default server page, default site, or an error page. In either case, that does not affect any other site SEO-wise.

For clarity redirecting the IP to an error page, 404 or another landing page is the best practice. None of which will negatively affect SEO of any domain hosted.


The answer to your question "What is the best practice for redirecting the IP address of a web server when it hosts multiple domain names?" is this: Best practice is to use a redirect (Apache) or return an error 444 (Nginx) to prevent host header attacks.

Your second question about SEO is irrelevant and has nothing to do with the title of your question, but you should ask a new question "Can redirecting requests for a server's IP address influence SEO?" if it worries you.

Here is an example for Apache:

<VirtualHost *:80>
  ServerName IP.AD.DR.ESS
  Redirect permanent / http://www.example.com/
</VirtualHost>

And here is an example for Nginx:

server {
  listen 80;
  server_name IP.AD.DR.ESS;
  return 444;
}

Both examples listen on port 80 only because redirecting HTTPS requests for the IP address on port 443 is not possible.