For some context, I'm modifying somebody's website. This particular site is not yet published - it is accessible via direct IP.
Problem: Google has crawled the direct IP, and people are reaching the site. If we put a robots.txt into the root directory of the site, that would also prevent Google from indexing the site once it's published on an actual domain.
Is there any way using robots.txt to prevent search engines from indexing the site's pages over direct IP, but allow it to index the site via its domain name?
(If not, then what would be required is to serve a different robots.txt depending on what domain the site is running on. The server could look at the HOST header to do this, but what is the best way?)