Use an errordocument to handle the request

New Page

404 Not found

The 404 Not Found HTTP response status code indicates that the server cannot find the requested resource. Links that lead to a 404 page are often referred to as dead or broken links and can be broken links.

A 404 status code only indicates that the resource is missing: not whether the absence is temporary or permanent. If a resource is permanently deleted, use status 410 (Missing) instead.

Condition

404 Custom Error Pages Not Found

You can display a custom 404 page to make it more useful to a user and provide guidance on what to do next. For example, for the Apache server, you can specify a path to a custom 404 page in an .htaccess file:

DocumentError 404 /notfound.html

To see an example of a custom 404 page, see this 404 page.

Note: Custom design is fine, in moderation. Feel free to make your 404 page humorous and human, but don’t confuse your users.

specifications

specification
HTTP semantics #status.404

Browser compatibility report issues with this compatibility data on GitHub

desk portable

Chromium

Edge

firefox

Opera

Safari

chrome android

Firefox for Android

android opera

Safari on iOS

Samsung Internet

Android web view

404

Full support

chrome yes

toggle history

Full support

edge 12

toggle history

Full support

firefox yes

toggle history

Full support

Opera Yes

toggle history

Full support

safari yes

toggle history

Full support

Android ChromeYes

toggle history

Full support

Firefox for Android Yes

toggle history

Full support

Opera Android Yes

toggle history

Full support

Safari on iOS Yes

toggle history

Full support

InternetSamsung Yes

toggle history

Full support

WebView Android Yes

toggle history

Legend

Tip: You can click/tap on a cell to get more information.

Full support Full support

The compatibility table on this page is generated from structured data. If you would like to contribute data, please visit https://github.com/mdn/browser-compat-data and send us a pull request.

See also

  • 410
  • Wikipedia: HTTP 404

Found a problem with this page?

  • Edit on GitHub
  • Source on GitHub
  • Report an issue with this content on GitHub
  • Do you want to solve the problem yourself? Consult our contribution guide.

Last modified: September 9, 2022, by MDN Contributors

Getting a 404 not found error when trying to use ErrorDocument

Ask

Asked 9 years, 11 months ago

Modified 7 years and 11 months ago

Seen 206,000 times

Report this ad

This question shows research effort; it is useful and clear

27

This question shows no research effort; unclear or not useful

5

Please mark this question.

View activity on this post.

I know this thread has been discussed a lot on the web and here, and I tried almost every method, but I still have the same problem.

This is my URL on my local server (MAMP)

http://localhost:8888/hellothere/index.php

And I tried to insert a wrong path to take me to the wrong page, like below:

http://localhost:8888/hellothere/eiurgiuerib

Instead of taking me to the error page, it displays:

Not Found The requested URL /hellothere/eiurgiuerib was not found on this server. Additionally, a 404 Not Found error was encountered while attempting to use an ErrorDocument to handle the request.

My 404 page is in the error directory. And in my .htaccess file I included this:

ErrorDocument 404 /Error/404.php

  • php
  • apache
  • .htaccess
  • status-code-http-404

To share

Share a link to this question

Copy link CC BY-SA 3.0

improve this question

Follow

Follow this question to receive notifications

asked on October 6, 2012 at 1:47 p.m.

User avatar of user1725155

user1725155 user1725155

335 1 1 gold badge 3 3 silver badges 11 11 bronze badges

3

  • 1

    La page d’erreur personnalisée ne fonctionne pas. Donc qu’est ce que je devrais faire?

    – utilisateur1725155

    6 octobre 2012 à 14:06

  • pouvez-vous montrer votre schéma de dossier ?

    –VariableStatique

    6 octobre 2012 à 14:17

  • Veuillez ne pas utiliser d’images pour afficher des données textuelles. Il dit que /Error/404.php est introuvable – Vérifiez l’orthographe, la casse et les autorisations de répertoire et de fichier. Vous devriez pouvoir invoquer 404.php à partir de l’adresse du navigateur — est-il trouvé ?

    – Phil Perry

    19 mai 2014 à 17:00

Ajouter un commentaire | 

2 réponses 2

Trié par : Réinitialiser par défaut

Score le plus élevé (par défaut) Tendance (les votes récents comptent plus) Date de modification (le plus récent en premier) Date de création (le plus ancien en premier)

Cette réponse est utile

cinquante

This answer is not helpful

View activity on this post.

The ErrorDocument directive, when providing a local URL path, expects the path to be fully qualified from DocumentRoot. In your case, that means the actual path to the ErrorDocument is

ErrorDocument 404 /hellothere/error/404page.html

compare

Share a link to this answer

Copy link CC BY-SA 3.0

Improve this answer

Follow

Follow this answer to receive notifications

answeredOctober 6, 2012 at 2:47 PM

StaticVariable user avatar

Static variable Static variable

5 243 4 4 gold badges 22 22 silver badges 45 45 bronze badges

3

  • Another thought, if in my index.php page I just add this line of code ” header(“HTTP/1.0 404 Not Found”); ” It won’t take me to the 404 page, why?

    – user1725155

    October 6, 2012 at 2:56 PM

  • @user1725155 you should read this post custom 404 not working

    –StaticVariable

    October 6, 2012 at 3:00 PM

  • Thank you very much, I was repeatedly trying to beat this in apache from the server root not the document root.

    – kit r007

    February 8, 2019 at 3:43 PM

Add a comment | 

Report this ad

This answer is helpful

1

This answer is not helpful

View activity on this post.

When we apply the local URL, the ErrorDocument directive expects the full path of DocumentRoot. there forever,

ErrorDocument 404 /yourfoldernames/errors/404.html

compare

Share a link to this answer

Copy link CC BY-SA 3.0

Improve this answer

Follow

Follow this answer to receive notifications

modified on October 4, 2014 at 10:44

NullPoiиteя user avatar

NullPoiиteя

55.5k 22 22 gold badges 123 123 silver badges 140 140 bronze badges

answered Mar 8, 2013 at 6:19

User avatar of karthik k

karthik k karthik k

49 3 3 bronze badges

Add a comment  | 

Highly active question. Earn 10 reputation (not counting the association bonus) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.

Not the answer you’re looking for? Browse other questions tagged

  • php
  • apache
  • .htaccess
  • http-status-code-404

or ask your own question.

  • The Overflow Blog
  • Five nines uptime without developer burnout (Ep. 488)

  • We hate Scrum and Agile…when it’s done wrong (Ep. 489)

  • Featured on Meta
  • Recent Color Contrast Changes and Accessibility Updates

  • ¡Revisor por la borda! O una solicitud para mejorar la guía de incorporación para nuevos…

  • Dois-je expliquer les réponses en code des autres ?

Report this ad

Report this ad

Leap

5

PHP 404 header not working

Related

443

How can I properly handle 404 in ASP.NET MVC?

1251

Reference – What does this error mean in PHP?

27

ErrorDocument 404 /404.php not working in .htaccess file in PHP

0

Getting an error in codeigniter: A 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request

0

htaccess: error 404 not found when trying to ErrorDocument

1

htaccess – 404 redirect error

0

Xampp error “Additionally, a 404 Not Found error was encountered while attempting to use an ErrorDocument to handle the request.”

burning questions from the net

  • The meaning of Deuteronomy 28:43 and its fulfillment
  • Is it acceptable to resubmit a manuscript to another publisher if there is no response after three months?
  • How could lottery and gambling work with accurate fortune tellers?
  • How many syllables do these rules say ‘each’ has?
  • Can I upgrade a mountain bike from ten years ago to modern standards?
  • What exactly did the MS-DOS “UNFORMAT” command do?
  • For smashed burgers, are you supposed to wait for the meat to come off the pan before flipping it?
  • Will Gmail, Facebook and WhatsApp still be accessible in Macao and Hong Kong in 2022?
  • Does scintillating spell metamagic apply to minor spells (e.g. Lightning Arc)?
  • 1987 Home Build: multiple 14-gauge circuit breaker loops on a 20-amp circuit
  • What is this component? White SMD part marked “W”
  • Difference between “unreal” and “not real”
  • When is it really worth converting RGB to CMYK (if printers do it anyway!)
  • Complex Harmonic Oscillator Spectrum
  • One way linked list in C
  • What is the status of songs that glorify illegal activities in different countries?
  • Is the fake ice cream on top of an ice cream truck called an “ice cream figure”?
  • How do modern processor manufacturers determine the appropriate base clock and associated power?
  • Assistance with idempotent arrays
  • How important is networking at conferences?
  • Has Batman ever been produced as an Arkham fan theory recluse in any medium?
  • Bitbucket: HTTP/2 stream 5 was not properly closed before the underlying stream ended
  • How can we extract potassium fluoride from the Earth?
  • securing a twisted beam

hotter questions

question flow

Subscribe to RSS

question flow

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.


Video Use an errordocument to handle the request

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…