I need help with Error 404 Display of my website. When i enter a wrong URL i get a Error 500 display. If i change the URL to a page that i'm sure is in the root, i still get this same Error 500 display.
Please where could the problem come from.
Both the .htaccess file and the 404.php are in the same directory ( root )...
Below is the content of my .htaccess file
ErrorDocument 404/church/404.php
this is the error in the Apache Error File
[Sat Apr 28 9:10:04] [alert] [client 127. 0. 0.1] C:/wamp/www/church/. htaccess: ErrorDocument takes two arguments, Change responses for HTTP errors
thanks for the help.
You're missing a space: it should say ErrorDocument 404 /church/404.php. (Well, I can't absolutely guarantee that that will work because I don't know what you have in your filesystem, but that's definitely righter than what you have now.)
Related
Note: the supposed duplicate is about how to access files with long names, but in my case, I don’t even want to check for it’s existence and have /_ah/conflogin/index.html.gz being used instead.
ErrorDocument 404 /_ah/conflogin/index.html.gz
Which when the document contains a ? and a long ᴜʀʟ after it results in a 403 error:
For example accessing /_ah/conflogin?state=~AJKiYcGTxysMayaAQSUXMAm3sKBrvlKLrR73oI_W8LXwAbHHy6M61MQ3SyI4md2Abg2Y_DWAlPPdH5nDKaB1Wafg3KKMltgR3WIcvkhV0aOlPbQ9TX21wOTXIcyhGPz4fCe6x_AT3XdIfDk2zqQ2mxCUW45qKhtNPFxG4SHzKg6sRuJPPF2o3QITLMZHbwS2yDQLaIuc298ROAUVu_3sgl0G9YZbM6K_mZEAqeI3zCX5MmG41eUfiX2wSxsSNPCLWQ24LAFuqOu4An9GqLYD4ycAh-EQKGG8P_2iKOYmkOcZytYeEF9I
triggers a HTTP 403 page with this error in the log:
[Sat Apr 13 17:26:29 2019] [error] (63)File name too long: access to /_ah/conflogin?state=~AJKiYcGTxysMayaAQSUXMAm3sKBrvlKLrR73oI_W8LXwAbHHy6M61MQ3SyI4md2Abg2Y_DWAlPPdH5nDKaB1Wafg3KKMltgR3WIcvkhV0aOlPbQ9TX21wOTXIcyhGPz4fCe6x_AT3XdIfDk2zqQ2mxCUW45qKhtNPFxG4SHzKg6sRuJPPF2o3QITLMZHbwS2yDQLaIuc298ROAUVu_3sgl0G9YZbM6K_mZEAqeI3zCX5MmG41eUfiX2wSxsSNPCLWQ24LAFuqOu4An9GqLYD4ycAh-EQKGG8P_2iKOYmkOcZytYeEF9I failed (filesystem path '/www/y/ytrezq/_ah/conflogin?state=~AJKiYcGTxysMayaAQSUXMAm3sKBrvlKLrR73oI_W8LXwAbHHy6M61MQ3SyI4md2Abg2Y_DWAlPPdH5nDKaB1Wafg3KKMltgR3WIcvkhV0aOlPbQ9TX21wOTXIcyhGPz4fCe6x_AT3XdIfDk2zqQ2mxCUW45qKhtNPFxG4SHzKg6sRuJPPF2o3QITLMZHbwS2yDQLaIuc298ROAUVu_3sgl0G9YZbM6K_mZEAqeI3zCX5MmG41eUfiX2wSxsSNPCLWQ24LAFuqOu4An9GqLYD4ycAh-EQKGG8P_2iKOYmkOcZytYeEF9I')
So how to make apache not ignore the ErrorDocument directive if the requested ᴜʀʟ is too long ?
In my httpd.conf file, every mention of the ErrorDocument has a hash before it on the same line - meaning that it's commented out.
So why do I get a 404 error page on the browser? How does the browser know what message to display?
I must be getting a 404 because this is displayed in the error_log;
[Wed Jun 25 12:21:17 2014] [error] [client **********] File does not exist: /var/www/html/surveys/blahblah
Is there a default setting somewhere?
My environment is Linux, Apache and PHP
You see Apache httpd's simple hardcoded message.
You need to configure an empty document as the ErrorDocument if you want a empty page to be displayed.
See the Apache Documentation or this question for further informations.
i have the following line in my .htaccess file which is situated on my PC at G:/xampp/htdocs/project/public_html/.htaccess
ErrorDocument 404 /404.html
So when I enter any non-valid address, for example http://localhost/project/public_html/blabla , the following message appears:
Not Found
The requested URL /project/public_html/blabla was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1 Server at localhost Port 80
But this is not my 404.html page!
But when I edit the ErrorDocument Syntax and include full link, i.e. make it:
ErrorDocument 404 http://localhost/project/public_html/404.html
but this redirects non existing links correctly to 404.html, but redirection is not what i want! I want a simple 404 error page!
Also one more strange thing is, when I remove the line completely from the .htaccess file, the error changes to this:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
1/4/2013 4:27:46 PM
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
creepy, eh? so could someone help me out and tell me whats going on please?
/ references the web root, so your paths don't quite make sense. Either move the file to the web root, or change the path to reflect the path relative to the web root. (Either move the file to /xampp/htdocs, or change the path to /project/public_html/404.html.)
The problem url links to my website are of the form
/fullpage.php%3F%20cp3_Hex%3D0F0200%26cp2_Hex%3D000000%26cp1_Hex%3DFC2024
The un-encoded url is
/fullpadge.php?cp3_Hex=0F0200&cp2_Hex=000000&cp1_Hex=FC2024
Apache returns a:
403: You don't have permission to access /fullpage.php? cp3_Hex=0F0200&cp2_Hex=000000
I have tried the following rewrite rule
RewriteRule ^/fullpage.php%3F(.*)$ /fullpage.php?$1
to no avail
Any ideas
You are almost certainly getting a 403 error.
The error is caused because ? is a banned file/directory name character on Windows and Linux. This means when Apache attempts to find a file or directory named "/document/root/index.php?blah" (after decoding) and it causes a 403 error. This is before the .htaccess files are read so you cannot use mod_rewrite in the .htaccess file to override this 403 error or an ErrorDocument defined in the .htaccess file to catch this error.
The only way to catch %3f is to use mod_rewrite or an ErrorDocument in a "VirtualHost" e.g. in httpd-vhosts.conf (or the main server configuration if there aren't any "Virtualhost"s e.g. in httpd.conf).
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 browser and the output is blank. Is there something special I need to do to enable 500 error documents for use with PHP?
My directives look like this:
ErrorDocument 401 /errorpage.php?error=401
ErrorDocument 403 /errorpage.php?error=403
ErrorDocument 404 /errorpage.php?error=404
ErrorDocument 500 /errorpage.php?error=500
I've looked through the php.ini and can't see anything that would obviously override the Apache settings and there are no ErrorDocument directives in my httpd.conf either. Anywhere else I should be looking?
Thanks in advance.
See this answer to a very similar question. Basically, PHP isn't hardly ever going to trigger a 500.
You may need to add the ErrorDocument declaration earlier in the Apache conf chain. If you add this to a vhost conf it may not be called.
I happened to encounter the same issue while working with codeigniter and Imagick. imagick was setting a 500 HTTP error when something went wrong and in that case Codeigniter's custom 500 message was not displayed.
I resolved this by adding try-catch to all Imagick functions.Check that where from the 500 issue is arising and then add a try-catch there.As for
ErrorDocument 500 /errorpage.php?error=500
,I read loads online about the same where some people claim that this solved their similar issue, others say that it wouldnt help as Apache has handed over the control to PHP.Maybe some php code is setting Headers to 500 and that would probably lead to the browser displaying its custom 500 error message.
I don't believe Apache will let you run PHP files for 500 errors because the error page could generate an error. Try rendering out your 500 error to an HTML file and point your directives at that.