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 1067747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:11:55+00:00 2026-05-16T20:11:55+00:00

I use .htaccess RewriteRules to pass the url to index.php. If the specified page

  • 0

I use .htaccess RewriteRules to pass the url to index.php. If the specified page name isn’t found in the database, I want my script to throw proper 404 responses.

The way I have tried to achieve this is:

header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");

Analysing the HTTP responses in my browser, the response comes back fine:

HTTP/1.1 404 Not Found 

However, I would like to be able to output a friendly 404 page, but anything after the header() function gets disregarded, and anything before … well … that’d be stupid.

Can anyone suggest how to output a 404 error message from the script?

Thanks.

  • 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-16T20:11:55+00:00Added an answer on May 16, 2026 at 8:11 pm

    You have to make sure the output (or ErrorDocument) is larger than 512 bytes as to make sure Internet Explorer doesn’t display it’s own error-page. This is probably why you have experienced any output after the header doesn’t get displayed.

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

Sidebar

Related Questions

I use .htaccess Mod Rewrite to send the URL to index.php, which then parses
I want to use htaccess to not only choose the script that processes the
I have a .htaccess file with content below which is changing my index.php?page=aboutus to
I have a page which is www.example.com/page_name.php?var1=dynamic_var1&var2=dynamic_var2 I want to use .htaccess file to
I currently use .htaccess and PHP to parse URLs in the following way: URL
I want to use .htaccess file to return homepage (index.html) if direct access to
I have managed to use .htaccess to redirect the domain url to a page
I use .htaccess to display my 404 page, while showing the requested URL in
I have a website that use this style : /index.php?page=45&info=whatever&anotherparam=2 I plan to have
I would like to use RewriteRules in .htaccess to achieve particular url rewriting, but

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.