I am working on a small project, I changed http://localhost to http://myowndomain.com and it's working good. I was curious and gave domain name to facebook.com . But it will redirect to original Facebook website.
I got an idea, and used apache rule
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^12\.34\.56\.789$
RewriteRule ^(.*)$ http://www.domainname.com/$1 [L,R=301]
Here, in the place of domainname if I use Facebook it will again redirect to original site.
Is there any way to so that I can bind my offline Facebook page (index.html) with my static ip address and I someone enters my ip, they get facebook.com in the domain name.
Sppofing dns replies is an overkill and modified hosts files on every pc is tedious. Not knowing your network doesn't help either but if I were you, to achieve what you want, I would use bind and rpz (https://www.zytrax.com/books/dns/) or dnsmaquerade (easier solution).
About your original problem, what you should do is:
Please remember "domainname.com" and "www.domainname.com" are different domains: both need to be resolved with an ip address (which can be the same) so if you want to use both domains, the virtualhost you have to setup must be configured to handle requests for for domains and it should look like this: