I was using Apple Safari on Mac OS X Yosemite and later on El Capitan just fine when suddenly one day I couldn't search from Safari's address bar. My search engine provider was Google but even changing the provider in Safari's preferences did not resolve the problem. The text I entered stood there and nothing happened. It looked like Safari froze. Other browsers like Firefox and Chrome were working just fine, which was telling me it is not DNS at least network wise.
Then I found out Safari prefetches DNS. In terminal you just write:
defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean falseThis command disables DNS prefetching. If this solves your problem then this is where you need to troubleshoot. Something in connection with your router and DNS is not OK.
Photo of stalled Safari