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

  • Home
  • SEARCH
  • 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 8962209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:05:05+00:00 2026-06-15T16:05:05+00:00

I have Apache and PHP setup and i am using a .htaccess file to

  • 0

I have Apache and PHP setup and i am using a .htaccess file to auto_prepend a file to any output.

The problem is when I want to output a 404 error using

<?php header("HTTP/1.0 404 Not Found"); ?>

It still outputs the header as the auto_prepended file has already been processed.

.htaccess file

php_value date.timezone 'Europe/London'
php_value auto_prepend_file load.php

load.php

<?php

    // Set the error reporting level (DEV)
    error_reporting(E_ALL);
    ini_set("display_errors", 1);

    // Load the configuration file
    include("config/config.php");

    session_start();

?>

So the load file includes the include for the config file so that it is set on every page that loads.

So at the moment I have some pages which are giving soft 404 errors rather than actual 404 errors, so if there is no data returned for say browsing to /image/123 because image 123 doesnt actually exist, I output a “This image doesnt exist” so this then causes problem for google or any other crawler as it can keep going from /image/123 …. /image/12222222333333444444 etc… So it actually needs to output a proper 404.

Hope someone can help.

  • 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-06-15T16:05:06+00:00Added an answer on June 15, 2026 at 4:05 pm

    I have found the answer in: PHP header 404 not working

    <?php
    header("HTTP/1.0 404 Not Found");
    exit("<h1>Not Found</h1>
    The requested URL " . $_SERVER["REQUEST_URI"] . " was not found on this server.
    <hr>");
    ?>
    

    This gives the correct 404 output.

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

Sidebar

Related Questions

I have a webserver setup using the standard linux, apache, mysql, php config and
I have successfully setup a localhost (Individual Installs) with Apache 2.2, MySQL and PHP,
I have quite a strange problem with PHP and Apache on my local testing
I have a product catalog using apache, php and mysql. I need to put
I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows
I currently have a Linux, Apache, MySQL, PHP, Postfix web server that I setup
My setup is: Fedora Linux / PHP / Apache I have a requirement to
I have a .htaccess file to remove the index.php part of the codeigniter-style URL.
I have a LAMP (Linux/Apache/MySQL/Php) application that I should release soon. Even if I've
I have just installed CentOS, Apache and PHP. When I visit my site http://example.com/myapp/

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.