Better to serve up an tiny file or a 404?
April 27, 2005 7:41 AM   Subscribe

Q for the webserver admin folks out there. I have a few web pages which are dead (old, retired, moved, etc). As a courtesy to some folks who were still linking to them (some dynamically generated javascript) I just left the files in place, but made them into tiny text files, preventing 404s and hanging pages. The question: which is better for the server (cheaper, less intensive) in this case? Serve up a tiny (or blank) text file - or - just delete the files and return 404s to all requests?

In my case in particular, it's IIS, but I figured this might be applicable to just about any webserver. Thanks!
posted by kokogiak to Computers & Internet (6 answers total)
 
What about a 301: Moved Permanently response code? I'm not sure how you'd use it in ISS, but this is what it's officially for.
posted by odinsdream at 7:52 AM on April 27, 2005


In terms of whatever else you're doing, both options are so miniscule that it doesn't matter which you pick.

If you wanted to get the smaller of the two, just return a 404. That way the server never really has to fetch any data off disk, it just has to know the file isn't there.

If you want to get even smaller, set up in the server config to return a redirect or a 301 (as odinsdream mentions). That way, the information about what to do with that request is in memory the whole time. No need to even check if the file is there.
posted by maschnitz at 8:05 AM on April 27, 2005


Cool, I wondered if there was any sort of hidden overhead for returning 404s. Thanks!
posted by kokogiak at 8:16 AM on April 27, 2005


That way the server never really has to fetch any data off disk

Unless you have custom 404 pages.
posted by null terminated at 8:44 AM on April 27, 2005


Why not just return the proper HTTP status code? Return the HTTP Status 410 Gone would be the most correct and ideal thing to do.
posted by riffola at 8:49 AM on April 27, 2005


odinsdream and riffola are correct. If the content exists somewhere else that people should be going, use 301. If it's gone use 410 so the it doesn't get bookmarked/indexed anymore and people know it's gone and not coming back.

Both of these will cut down on traffic more than a tiny text file or a 404 because browsers will use the new location or stop asking for it.
posted by revgeorge at 10:46 AM on April 27, 2005


« Older Make my jeans last longer!   |   How do I sleep when I'm a lab rat? Newer »
This thread is closed to new comments.