Anchor links and HTML page navigation working locally but giving 404 on Netlify (static Bootstrap site)

1 day ago 1
ARTICLE AD BOX

I'm new to web development and this is my first time deploying a project on Netlify. I’ve tried to debug this issue myself but couldn’t figure it out.

I have deployed a static Bootstrap website on Netlify, but I’m facing a 404 issue with some navigation links.

Project links

GitHub repo: https://github.com/Rohit-specs/Project-Bootstrap.git

Live site: https://gleeful-stardust-8e7c73.netlify.app/


Navbar code

<div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav me-md-auto mb-2 mb-lg-0"> <li class="nav-item"> <a class="nav-link active" href="#banner-section">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="courses.html">Courses</a> </li> <li class="nav-item"> <a class="nav-link" href="#our-testimonial">About Us</a> </li> <li class="nav-item"> <a class="nav-link" href="#our-pricing">Pricing</a> </li> <li class="nav-item"> <a class="nav-link" href="contact.html">Contact</a> </li> </ul> </div>

What works

Section navigation using #id works locally

Links like #banner-section, #our-pricing are correct and IDs exist


The problem

On the deployed Netlify site:

Some links still result in 404 Page Not Found

Especially when navigating or refreshing certain routes

It sometimes tries to open paths like:

/courses.html

/contact.html


What I already tried

Replaced ./features style links with #id

Verified IDs match exactly (case-sensitive)

Ensured .html is included for page links

Redeployed the site after changes

Checked file names and structure in GitHub


My questions

Why would a static site still give 404 for valid .html files on Netlify?

Do I need a _redirects file even if I’m not using a SPA?

Could this be related to file placement (root vs folder) or case sensitivity?


Expected behavior

Section links (#id) should scroll within the same page

Links like courses.html and contact.html should open corresponding pages without 404


Any help would be appreciated. I feel like I’m missing something small but can’t figure it out.

Read Entire Article