Search code examples
phpimagedownloadwindows-server

URL Says "404 Not Found", Yet File Downloads


I built a web application for a client and then transferred it over to his server. It didn't work, so I had to call the server company and have them fix it. It was nice of them, but now I have to change all my web roots around. While doing it, I found a weird bug when it comes to URLs that go to files. Instead of being able to view the files (like an image) I get a 404 Error: "Page cannot be displayed, The requested URL was not found on this server." Yet, at the same time, the image downloads. I have never seen this before in my life. I don't want to automatically download an image: I just want to view it.

Does anybody have any idea why this is happening, and how I can prevent it.

An example URL is http://holyfamilyregina.com/CMS/downloads/images/cwl.png

Thank you.


Solution

  • Here are the headers that I get from the image in your post:

    HTTP/1.1 200 OK
    Expires: Sun, 07 Apr 2023 04:18:16 GMT
    Server: IceWarp/10.4.4
    Date: Sun, 07 Apr 2013 04:18:16 GMT
    Content-Type: application/octet-stream
    Content-Length: 9797
    Last-Modified: Sun, 07 Apr 2013 03:47:12 GMT
    

    No 404, but the file's content type is set to octet-stream (a stream of 8 bits), which is used when you want someone to download a file.

    You need to tell your server company to configure the server so that it serves images with their proper Content-Type headers.