Questions tagged [errordocument]
74 questions
11
votes
1 answer
Apache Httpd Custom ErrorDocument 404 When ProxyPass returned 404
I have an Apache web server in front of another application server, using Proxy Pass. When the request to application returned error 404, I want to show custom error page from the web server not the one that come from application server. I have…

hendry.fu
- 225
- 1
- 2
- 7
9
votes
4 answers
Apache: Redirect 404 and ErrorDocument 404 difference
I would like to do a 404 redirect with Apache, and I find several solutions:
The .htaccess method. But I don't want to add a .htaccess if not necessary.
virtual host method:
ServerAlias *.example.com
Redirect 404…

DocWiki
- 683
- 2
- 7
- 8
7
votes
3 answers
NGINX default error page
I'm trying to set a default error_page for my entire nginx server (as in for all vhosts).
I'm trying it with following code:
http {
...
...
error_page 404 /var/www/default/404.html;
...
...
}
Also, I'd like to be able to create…

alexandernst
- 534
- 3
- 9
- 21
5
votes
2 answers
ErrorDocument in .htaccess, is it possible to use relative path?
This doesn't work:
ErrorDocument 401 ../../src/wrong_pwd.php
it renders the path as text, it really prints
../../src/wrong_pwd.php
and doesn't output the real file.
If I put the absolute path it will render the contents of /var/www/home (I…

Andrea Ambu
- 480
- 1
- 8
- 13
5
votes
1 answer
How to make Apache return a custom page on a 400 error with malformed host headers?
I think what I was asking for was a bit hard to understand, so, I am trying to make it simpler...
I need my server to have a custom 400 error page when it receives a request with a malformed host header.
What I ideally want is ErrorDocument 400…

William Hilsum
- 3,536
- 6
- 29
- 39
4
votes
1 answer
Apache ErrorDocument directive not working
I can't get a custom error document to work for 400 Bad Request. It's a CentOS LAMP server.
ErrorDocument 400 /badrdoc.html
I've tried using the above in:
Apache http.conf
Apache httpd-vhosts.conf (in each vhost)
.htaccess in the root htdocs of…

ServerBloke
- 402
- 1
- 10
- 20
4
votes
1 answer
How to catch all errors by ErrorDocument
There is a possibility to set a error page using the ErrorDocument separately like this:
ErrorDocument 403 /site.html
ErrorDocument 404 /site.html
ErrorDocument 500 /site.html
But is there a way to catch all errors with on-line command at once?…

elon
- 123
- 2
- 10
4
votes
1 answer
Problems redirecting Error 400 Bad Request to custom page
I've edited my .htaccess file to the following :
ErrorDocument 404 /index.php?page=page-not-found
ErrorDocument 400 /index.php?page=bad-request
Now the error 404 redirects correctly, yet if I enter an address like…

Paul
- 180
- 1
- 1
- 7
3
votes
2 answers
Special characters in URL causes custom redirect to fail
I have a domain on which I am trying to set custom redirects for the error pages.
My .htaccess file looks like so:
RewriteEngine On
AddDefaultCharset UTF-8
DefaultLanguage en-US
# disable TRACK and TRACE http methods. 'RewriteEngine On' is…

Sriram
- 201
- 1
- 4
- 8
3
votes
1 answer
Apache ErrorDocument in an alias
I am trying to set a custom error document in an alias.
Alias /f1 "/media/data/www/f1"
AddHandler cgi-script .cgi .pl
Options Includes Indexes MultiViews FollowSymLinks ExecCGI
AllowOverride…

Lord Loh.
- 1,089
- 3
- 16
- 25
3
votes
1 answer
How do I get meaningful error messages in IIS7?
I have a classic ASP website that is crashing in IIS7.
It is crashing because IIS doesn't allow file uploads greater than a certain size. I know this because files below about 200k work fine.
I removed the Status Code 500 error in IIS but I still…

Petras
- 249
- 1
- 4
- 13
2
votes
3 answers
Nginx - how to disable rewrite for error_page
I'm currently hosting a couple small static websites using Nginx 1.10.2 on Fedora 25 Server Edition x86_64.
I've configured Nginx to assume the .html for requests with no file extension (try_files), and to redirect (permanent rewrite) to the…
user292113
2
votes
1 answer
htaccess redirect of 404 error just prints filename, doesn't execute file
On an Apache host, I have a folder called /thumbs with a program in it called program.php that I will use to create thumbnails.
There is a .htaccess file that contains the following lines:
options -indexes
errordocument 404 program.php
What should…

Andy Swift
- 87
- 2
- 13
2
votes
2 answers
Apache ErrorDocument script location
Using apache 2.4 on Linux, with several virtual servers, each virtual server with its own DocumentRoot, I would like for the apache main server ErrorDocument local redirect to execute a single perl script relevant to the apache main DocumentRoot,…

keith20mm
- 31
- 1
- 2
2
votes
3 answers
Can I make Apache ErrorDocument return 404 instead of 301?
In my .htaccess I have
ErrorDocument 404 http://foo.com/404.html
It works, in the sense that I recover from any file not found error and show the 404 page instead, but the way it works is to redirect the erroneous URI using a 301 to my 404.html…

coneybeare
- 621
- 1
- 7
- 14