Certain websites not opening in mac

I am connected to my university's internet. Internet websites open perfectly fine. However, university-related sites do not load. When I try to open those sites, it tries to load for a long time and then throws a "could not find server" error. However, when I switch to a non-university internet connection, publicly hosted university sites (like the university homepage) load.

I am running macOS Catalina.

Although, I have found a hack that worked. If somebody has a proper solution that works or why this hack worked, let me know.


Initially, I tried these solutions. However, they did not work.

The solution that worked: Removing the Google public DNS addresses from the DNS servers list. I had added them earlier for a VPN to work. system-prefs