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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:09:28+00:00 2026-05-27T11:09:28+00:00

I’m using Apache 2.2.X and PHP 5.2.X (installed as Apache module) to build a

  • 0

I’m using Apache 2.2.X and PHP 5.2.X (installed as Apache module) to build a new website and I would like to read your suggestions about how I’m trying to handle server errors.
I was thinking about using the same file of my homepage (/index.php) to show custom error messages.
This is my .htaccess setup:

ErrorDocument 400 /index.php?error=400
ErrorDocument 401 /index.php?error=401
ErrorDocument 403 /index.php?error=403
ErrorDocument 404 /index.php?error=404
ErrorDocument 500 /index.php?error=500

Now, in my index.php file I have some code that looks like this:

if (isset($_GET['error']))
    DrawErrorPage($_GET['error']);
else
    DrawHomepage();

Everything works like a charm.
Well, everything except one thing that I can’t fix: if I force Apache to respond with a 500 status code (for example, inserting malformed code into my .htaccess), I’m not being redirected to “/index.php?error=500”, but I get the default 500 error page instead. With any other status code (for example, 403 or 404) my configuration works absolutely perfectly.

But now I’ve a doubt and I’m starting to think that it would be better to use another page to handle errors (for example, “/error.php”).
“DrawHomepage()” needs to set “robots” meta tag to “index, follow”, while “DrawErrorPage()” needs to set it to “noindex, nofollow”. Right? So… what would happen if a web crawler gets an error response visiting my homepage for the first time? What would happen if a web crawler gets 200 visiting my homepage for the first time, but a 500 visiting it a month later? And what would happen if I keep my “robots” meta tag to “index, follow” even if I’m showing errors?

Is there a workaround, a solution, for this problem? What would you do?

Many 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-27T11:09:28+00:00Added an answer on May 27, 2026 at 11:09 am

    Usually if there is a 500 status code then Apache has messed something up and it can’t run your index.php file, resulting in another 500 status code. Apache continues this error loop for a few iterations before it finally says “no more loops” and sending its own error page.

    The only really safe way to display a custom page for a 500 status code is to use plain text or use a basic .html or .shtml file that doesn’t try to access other things on your server, so you don’t keep triggering more 500 status codes in the page load.

    Usually if a crawler encounters a 500, it will just ignore the page temporarily. A 500 code is recoverable, it doesn’t necessarily mean there is no page there, just that the server is messed up at the moment. The bots are smart and can determine what error codes mean what, as long as the page is always sending the status code in the page header.

    Remember, if you use a PHP file as your error document, you need to resend the HTTP status code using the header function inside PHP to ensure proper page detection, like so:

    header("HTTP/1.1 404 Page Not Found");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.