HTTP error code and Message

  1. Informational responses (100 – 199)
  2. Successful responses (200 – 299)
  3. Redirection messages (300 – 399)
  4. Client error responses (400 – 499)
  5. Server error responses (500 – 599)
In our site we will we use http error codes to give appropriate error message and advise visitors to visit correct location by using various commands and codes. Here are some examples

301 Moved permanently

We have one old page and now we found that this is no longer required and visitor should go to another page. Just deleting the page or changing the navigation links pointing to the page is not enough. Other websites or search engines might kept links pointing to our page which is not in our control . To manage such situation we just keep the file with the following code inside it.
<?Php
header("HTTP/1.1 301 Moved Permanently");
header ("Location: newpage.php");
exit; 
?>
The above code is written in PHP. The first line says about the error type and give the message saying the page is no longer exit. The second line will redirect the visitor auotmatically to a different page marked for this. If you don't want automatic redirection then you can show a message and ask the visitor to click a link to move away.
echo "This topic is moved or deleted, return to <a href=https://www.plus2net.com>Home page</a>";
The last line may not be required. Just a second line of protection if you have any code below it to.

302 Moved temporarily

Here we can show temporary movement of page and same redirection is used as above.

404 Not found

The required page is not found in the server so the visitor can be redirected to a custom error page saying sorry or any other message. This can be achieved by using .htaccess file or your web host can give you this page from your control panel.

Be the first to post comment on this article :

plus2net.com



Search Engine Optimization and google articles

Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer