Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

html - 404 page not found - Go rendering css file

I'm currently working in Go. I created a web server on my local machine. I followed the instruction on this page Rendering CSS in a Go Web Application but I'm still getting the 404 error that the program can't seem to find where my css file is. My directory is as follows.

In src folder contains css/somefilename.css, src also contains server/server.go.

The code inside my server.go file is as follows.

http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css"))))

When I go to localhost:8080/css/ I get 404 page not found. I'm also using templates to render the html code. The templates are in the folder

src/templates/layout.html

the html code is as follows:

<link rel="stylesheet" type="text/css" href="../css/css490.css" />
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...