Questions tagged [errordocument]

What the server will return to the client in case of an error.

168 questions
46
votes
5 answers

Single ErrorDocument directive to catch all errors (.htaccess)

Is there something like a wildcard directive to catch all possible errors and deal with them in a single custom error page? ErrorDocument 404 /error.php?code=404 ErrorDocument 403 /error.php?code=403 ... ErrorDocument NNN /error.php?code=NNN…
mkvlrn
  • 758
  • 1
  • 8
  • 20
14
votes
2 answers

Apache's ErrorDocument directive does not redirect

I have a bunch of ErrorDocument directives in my .htaccess file in order to catch almost all the possible errors Apache can throw at a user, and to redirect said user to my error controller which would then render the error in a more user friendly…
Swader
  • 11,387
  • 14
  • 50
  • 84
12
votes
5 answers

Custom 404 page - PHP

I have a custom 404 page which works fine except for the message I want to display on this page. I would like it to say the url of the page which can't be found but instead it displays the url of the 404 page. Here's what I have... You were looking…
Tom
  • 12,776
  • 48
  • 145
  • 240
8
votes
6 answers

How to get .htaccess to attach REQUEST_URI to 404 page

Is there a way to send the request URI along to the 404 page as a URL variable? For instance, if I forward my 404's with an ErrorDocument directive, is there a way to do something like this? This is the code I tried but it obviously didn't…
SISYN
  • 2,209
  • 5
  • 24
  • 45
7
votes
4 answers

Apache ErrorDocument External Redirect with Variables

Is something like this possible in Apache ... (i.e. redirect to an external url with the path causing the 403 error passed along) ErrorDocument 403 http://www.sample.com/{{REDIRECT_URL}}
Pykler
  • 14,565
  • 9
  • 41
  • 50
5
votes
3 answers

How to solve add a custom error 503 page html on ubuntu apache2 using it with mod_jk and virtual host redirecting to tomcat

I tried all I found at apache documentation and other sugestions found at stackoverflow and blogs. When I add the folloowing line to any configuration file like /etc/apache2/apache2.conf or /etc/apache2/conf.d/localized-error-pages or…
Danilo Marques
  • 136
  • 1
  • 1
  • 8
5
votes
4 answers

Apache ErrorDocument not working for PHP 500 error

I have a number of ErrorDocuments setup in my .htaccess file for errors such as 404, 401, 403 etc which all redirect to my error page but the ErrorDocument set for a 500 error is never displayed when PHP reports a 500. The 500 code is sent to the…
user187708
5
votes
1 answer

Use 404 ErrorDocument that is in a sub directory

I have a htaccess file in a sub folder like so: /subfolder/.htaccess In the htaccess file the following code to set a 404 ErrorDocument ErrorDocument 404 /404.php The issue is the 404 page in the root directory is loaded rather than the one in the…
Tom
  • 950
  • 3
  • 15
  • 27
4
votes
2 answers

Apache Error Document is not working

I am running the apache2 webserver in the linux environment.I want to redirect the users to customized error pages.So have created the error pages & created the symbolic link in the htdocs also like this. static-files -> /app/static-files. And in…
Suresh
  • 134
  • 5
  • 14
4
votes
2 answers

Content-Type in ErrorDocument

I am building a small framework for my API's since they are quite specific, but I have a problem with the Content-Type when I received data for an ErrorDocument. Currently, I have the following .htaccess: Header set…
Sietse
  • 623
  • 1
  • 8
  • 23
4
votes
1 answer

Using Errordocument 401 leads to blank page

My .htaccess looks like this: ErrorDocument 401 /error/401.html AuthType Basic AuthName "Password Protected Area" AuthUserFile /var/www/vhosts/funatodev.de/httpdocs/wordpress/.htpasswd AuthGroupFile /dev/null Require valid-user # BEGIN WordPress #…
Sebastian Starke
  • 5,198
  • 3
  • 24
  • 35
4
votes
1 answer

Redirect instead of 404 Error page - Status Code not working (Nginx)

I'm currently moving to an nginx server. I tried putting this in my 404 ErrorDocument named 404.php: If I now try to access http://mydomain.com/404.php, this works as expected: It redirects…
Chiru
  • 3,661
  • 1
  • 20
  • 30
4
votes
6 answers

How to use errordocument to redirect to a php file in the same folder?

I want to take requests for missing files in a specific folder and redirect them to program.php in that folder. This is a program I will use a lot in different places, and I would prefer to avoid specifying the name of the folder in the htaccess…
Andy Swift
  • 2,179
  • 3
  • 32
  • 53
4
votes
1 answer

What is "lazy caching"?

I was re-reading this great article and stumbled upon something I haven't noticed earlier, it's what the author calls Lazy Caching. To be precise here's the context: Do they know how to use the Error Document to do lazy caching? What is lazy…
Sergey Telshevsky
  • 12,077
  • 6
  • 55
  • 78
4
votes
2 answers

Error document and rewriting URL

I would like to use a custom page for some HTTP error, so I use the .htaccess file. At the same time I would like to use the URL rewriting, but that doesn't work and I don't know why. This is my .htaccess : #Rewrite options RewriteEngine On #…
Guillaume
  • 8,741
  • 11
  • 49
  • 62
1
2 3
11 12