Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:01:38+00:00 2026-05-26T06:01:38+00:00

On a standard LAMP application i am sending people to my 404 page using

  • 0

On a standard LAMP application i am sending people to my 404 page using a .htaccess rule like so:

ErrorDocument 404 http://www.mydomain.com/404.php

We serve dynamic images using a php file which reads files from the filesystem, i’ve just noticed though that when an image is deleted from the app that we’re not picking this up so a request for http://www.mydomain.com/image_4.jg (for example) which calls image.php using mod_rewrite doesn’t redirect the user to the 404 page as the dynamic image file will always exist. In this case i know i should be using a 404 but i’m not sure where.

Obviously i know i need to manually insert a header redirect to the 404.php page when the image has been deleted but should i actually send a 404 header with this redirect?. Looking at the code our 404.php page actually sends a 404 header already with ("HTTP/1.1 404 Not Found"); which is what our SEO team had instructed a few years back, not sure if this is correct or not?. It seems counter-intuitive to me as it would almost imply that the 404 page itself has not been found.

I guess this is 2 questions then:

  • Should i send a 404 header within the redirect when the image is not
    found?
  • Should my 404 page actually send a 404 header?

EDIT

It doesn’t actually seem possible to send a 404 and redirect at the same time, for example this causes Chrome to show a “Oops! This link appears to be broken.” message

header( "Location: /404.php", true, 404 );

If you break up the headers like this it also doesn’t work as intended

header("HTTP/1.1 404 Not Found");
header("Location: /404.php" );

In this case, if you look at the headers it sends a 302 followed by a 404. Is it enough in this case to maybe just send a header without a redirect? maybe just send a 410 as recommended by some?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:01:39+00:00Added an answer on May 26, 2026 at 6:01 am

    404 Not Found

    The server has not found anything matching the Request-URI. No
    indication is given of whether the condition is temporary or
    permanent. The 410 (Gone) status code SHOULD be used if the server
    knows, through some internally configurable mechanism, that an old
    resource is permanently unavailable and has no forwarding address.
    This status code is commonly used when the server does not wish to
    reveal exactly why the request has been refused, or when no other
    response is applicable.

    — Status Code Definitions

    A 404 response should be sent back to the client when a resource is not found.

    Should i send a 404 header within the redirect when the image is not
    found?

    Yes. This tells the client requesting the dynamic image that the resource wasn’t found. If you know the resource will never return, use 410 (Gone) instead.

    Should my 404 page actually send a 404 header?

    Yes. See 404 Error Pages and Redirects for SEOs

    Update

    header("HTTP/1.0 404 Not Found"); should be sufficient; however, Google Chrome fails to display a custom 404 page if the content is less than 512 bytes in length.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing some websites on my Mac (Standard LAMP setup, with PHP5, Using
Using a standard LAMP server with full control, I need to upload an image
I have a standard LAMP server, and currently there is a way to attach/upload
Pretty much all of our sites are setup the standard mod_php , apache2, LAMP
I am running a fairly standard LAMP stack. The problem is an intermittent rendering
I would like to compress a directory using 7-Zip and then download it to
Suppose my web app is written in PHP & Mysql on the standard LAMP
All the required libraries are set for soap. I'm using standard WSDL. Moved my
We need to add a text watermark to an image, using something like imagegettftext.
so suppose my server is located in http://www.example.com I then put a file file.exe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.