Get a Pentest and security assessment of your IT network.

Cyber Security

Fix Hostname Mismatch Error

TL;DR

Your computer thinks a website’s address is wrong, which could mean someone is trying to trick you. This guide shows how to check and fix it.

What’s happening?

A Hostname Mismatch error means the name your browser uses to find a website (like www.example.com) doesn’t match the actual address the server presents (its IP address). This can happen for several reasons, including:

  • Incorrect DNS settings
  • Your hosts file being modified
  • A problem with your browser’s cache
  • Man-in-the-Middle attack (less common but serious)

How to fix it

  1. Clear Your Browser Cache
    • Most browsers store website information. Clearing this can resolve outdated or incorrect entries.
      • Chrome: Press Ctrl+Shift+Delete (or Cmd+Shift+Delete on Mac). Select ‘Cached images and files’ and click ‘Clear data’.
      • Firefox: Press Ctrl+Shift+Delete. Select ‘Cache’ and click ‘Clear Now’.
      • Edge: Press Ctrl+Shift+Delete. Select ‘Cached images and files’ and click ‘Clear now’.
  2. Flush Your DNS Cache

    Your computer stores recently used website addresses to speed things up. Sometimes this cache gets corrupted.

    • Windows: Open Command Prompt as an administrator (search for ‘cmd’, right-click, and select ‘Run as administrator’). Type ipconfig /flushdns and press Enter.
      ipconfig /flushdns
    • macOS: Open Terminal (Applications > Utilities). Type sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder and press Enter. You’ll need to enter your password.
      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
    • Linux: The command varies depending on your distribution. Common commands include sudo systemd-resolve --flush-caches or sudo /etc/init.d/networking restart.
  3. Check Your Hosts File

    The hosts file maps website names to IP addresses directly. If it’s been altered, it can cause mismatches.

    • Windows: Open Notepad as an administrator (search for ‘notepad’, right-click, and select ‘Run as administrator’). Open the file C:WindowsSystem32driversetchosts.

      Look for any unusual entries. Comment them out by adding a ‘#’ at the beginning of the line.

    • macOS/Linux: Open Terminal. Type sudo nano /etc/hosts and press Enter. You’ll need your password.

      Look for any unusual entries. Comment them out by adding a ‘#’ at the beginning of the line.

  4. Verify DNS Server Settings

    Your internet service provider (ISP) usually provides DNS servers automatically. Sometimes, these can be unreliable. Consider using public DNS servers like Google’s or Cloudflare’s.

    • Windows: Go to Network and Sharing Center > Change adapter settings. Right-click your network connection and select ‘Properties’. Select ‘Internet Protocol Version 4 (TCP/IPv4)’ and click ‘Properties’. Select ‘Use the following DNS server addresses’ and enter:
      • Preferred DNS server: 8.8.8.8
      • Alternate DNS server: 8.8.4.4 (Google) or 1.1.1.1 (Cloudflare)
    • macOS: Go to System Preferences > Network. Select your network connection and click ‘Advanced’. Go to the ‘DNS’ tab. Add DNS servers using the ‘+’ button:
      • 8.8.8.8
      • 8.8.4.4 (Google) or 1.1.1.1 (Cloudflare)
  5. Check for Malware

    Malware can sometimes modify system files like the hosts file. Run a full scan with your antivirus software.

  6. cyber security Check: SSL Certificate

    If you’re seeing this error on an HTTPS website (the address starts with https://), it could indicate a problem with the website’s SSL certificate. Most browsers will show a clear warning if the certificate is invalid or expired.

Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation