Is it possible to blocking only a certain subpage of a website instead of all domain by modifying /etc/hosts file? For example I want to block http://example.com/whatever.html instead of all domain http://example.com. I tried to put just 0.0.0.0 http://example.com/whatever.html but it does not work. 
Blocking only a certain subpage of a website
http;http proxy
No./etc/hosts is used to modify the hostname -> IP address mapping.  It can not be used for protocol layer filtering.  If you want to limit specific pages then you need to use something like a proxy server.  This can be programmed with specific rules to permit/deny certain pages.  Then configure your browser to use that proxy.A simple example of this is Privoxy (https://www.privoxy.org/) but there are lots of tools.EDIT TO ADD:  Alternatively a browser plugin (eg ublock origin or adblock plus) can be configured to block access to pages directly inside the browser.