1

I'm currently developing a simple static web page with only HTML. I'm using tags with href to link to different pages and the VS code live server used to work when I inserted a link like page1.html it would send the browser to this page. But I prefer to have just the page without the .html.

When I remove the .html from the link the live server gives an error: Cannot GET /page1 But when I deploy my site on Netlify it does, however, find the page, but this breaks the development process for me.

How can I fix the live server so it also gets sent to the correct page?

Thank you in advance, Timo

JustAG33K
  • 1,403
  • 3
  • 13
  • 28
Timo Frionnet
  • 474
  • 3
  • 16

4 Answers4

1

This is a common server behaviour. The server tries to find a file or folder name page1 but doesn't find it. Nothing wrong with live server. I guess Netlify is the one doing extra magic.

However if you want to remove the .html in page1 you could create a folder name page1 and put inside a index.html with the content. This way the server will find the folder named page1 and return the index.html. This will also work with live server and any standard server.

This is how your folder structure could look like: enter image description here

Andres Abadia
  • 817
  • 7
  • 14
  • Thank you for explaining, this makes sense and is the best solution. I've had to redo most of the imports (../) but it now works for both in netlify and with live server development! – Timo Frionnet Sep 14 '22 at 17:52
1

Cannot GET /source/gfdfghdgh/A/1&2.html

This is the error I get because of the '&' symbol.

Make sure your file name is browser friendly.

0
      VS CODE LIVE SERVER CANNOT GET ERROR MESSAGE

Restart VSCode Sometimes the best you can do is start VSCode from scratch. First, save all of your work. Then close VSCode, which will also stop all of the extensions you've installed. Then, reopen VSCode and try again – go to the HTML file you want to view, right-click## Heading ##, and select "Open with Live Server".

0

Removed the ':5500' from the URl and it started working.

Changed from : http://127.0.0.1:5500/chat_system/dashboard.php

to : http://127.0.0.1/chat_system/dashboard.php

Anush
  • 1