Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load resource: the server responded with a status of 404 (Not Found) error in server

Tags:

html

.net

css

I'm trying to load up image in my Image Folder, but it's not working.

Upon debugging, I see this error:

Failed to load resource: the server responded with a status of 404 (Not Found)     

My image coding is in .css file that is,

background: url("../Images/bgbody.png") no-repeat;    

What am I doing wrong here?

like image 560
Saranya Avatar asked Apr 05 '13 01:04

Saranya


People also ask

What does “failed to load resource status of 404” mean?

Therefore, the “failed to load resource: the server responded with a status of 404” error is caused when your website’s code mentions a file but the browser can not download. In different environments, each website will display this error with different messages next to them.

What is HTTP 404 Not Found client error?

The HTTP 404 Not Found client error response code indicates that the server can not find requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist.

What does the 404 status code mean?

Additionally, 404 status code is used when the requested resource is not found, whether it doesn't exist or if there was a 401 or 403 that, for security reasons, the service wants to mask. When I tried your code block, I faced similar consequences.

What is the difference between HTTP 429 and HTTP 404?

Therefore, servers are not required to use the 429 status code; when limiting resource usage, it may be more appropriate to just drop connections, or take other steps. The HTTP 404 Not Found client error response code indicates that the server can not find requested resource. In the browser, this means the URL is not recognized.


1 Answers

Use your browser's network inspector (F12) to see when the browser is requesting the bgbody.png image and what absolute path it's using and why the server is returning a 404 response.

...assuming that bgbody.png actually exists :)

Is your CSS in a stylesheet file or in a <style> block in a page? If it's in a stylesheet then the relative path must be relative to the CSS stylesheet (not the document that references it). If it's in a page then it must be relative to the current resource path. If you're using non-filesystem-based resource paths (i.e. using URL rewriting or URL routing) then this will cause problems and it's best to always use absolute paths.

Going by your relative path it looks like you store your images separately from your stylesheets. I don't think this is a good idea - I support storing images and other resources, like fonts, in the same directory as the stylesheet itself, as it simplifies paths and is also a more logical filesystem arrangement.

like image 111
Dai Avatar answered Sep 20 '22 23:09

Dai