Using Python SimpleHTTPServer to serve files without .html

Viewed 203

I want to use SimpleHTTPServer to serve my local site while I'm developing. I'm using basic javascript, HTML, and CSS. I have this kind of project structure:

  • app (folder with src files)
  • dist (build folder where everything is located for a host)
    • assets (css, js, etc)
    • services (html files for different services)
    • name_of_service_1.html
    • name_of_service_2.html
    • index.html
    • services.html
  • package.json
  • gulp.js

Inside navigation I have a basic structure for every link, something like this:

<a href="/services">Services</a>
<a href="/services/name_of_service_1>Service 1</a>

Besides this, I'm using HTML preload, so that pages are loaded faster if someone hovers over those links. Because of that, I can't use services.html or etc, because in that case, preload won't work. I'm using netlify to host this site, and there everything works fine.

My question: How to serve locally with SimpleHTTPServer but that page will load nicely without .html extension in the link.

0 Answers
Related