500 Internal Server Error instead of 404 - .htaccess

This is my .htaccess
ErrorDocument 404 /404.html
But when i type a wrong url for example, http://127.0.0.1:8080/myweb/wrong-url.php, that doesn't go to 404.html and says 500 INTERNAL SERVER ERROR
any body can explain why?
The error that is showing in my error log is
AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error.
Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

It is likely that your 404.html page is, itself, generating another 404 because the location is not /404.html, but /myweb/404.html. Basically it tries to find the 404.html file, but can't, which generates another 404, then tries to find the 404.html file, but can't, which generates another 404 etc etc. Change your .htaccess to point the 404 to /myweb/404.html, or move the file to the root of your server.

Related

How to redirect user to an error page when 404 error occurred

I am trying to redirect the user to a page when 404 error occurred, so I am writing
ErrorDocument 404 /error.html
In .htaccess file and having an error.html file in my root directory but it's giving me
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Try resetting the error document to the system default prior to setting your custom document. For example:
ErrorDocument 404 default
ErrorDocument 404 /error.html
On some shared servers, the error document is (incorrectly) preconfigured in the main server config.

.htaccess Redirect to a page with some GET variables on error

I want .htaccess to redirect to index.php on error, but with submitting some special GET variables.
For example, on error 404 I want it to redirect to
/index.php?article=404.php
I don't know how to do that as I haven't found any good tutorial for it.
This is what I tried:
RewriteEngine on
ErrorDocument 404 /index.php?article=404.php
ErrorDocument 403 /index.php?article=403.html
It seemed to work for 404 error, but for 403 error it shown:
Forbidden You don't have permission to access [...] on
this server. Additionally, a 404 Not Found error was
encountered while trying to use an ErrorDocument to handle the
request.
How should I do it?

404 Redirect Error with .htaccess

I'm running a website on a local server (using WAMP Server) and I'm trying to test to see if my 404 page would work, but when I try to navigate to a nonexistent page, I get an error that says:
The requested URL /dsf/sdkmf was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.
My 404 page is in the root folder with all my other pages and my .htaccess Error Document handle is listed as:
ErrorDocument 404 /404.html
I don't know why it's throwing me this error much less how to fix it, does it have something to do with my WAMPServer configuration?
Never mind - I figured out how to solve it on my own - apparently you have to use the direct path to the file - even if it's in the root directory of the site itself!

404 errors being redirected to the homepage instead of custom 404 page

I have a site hosted on an Apache server. I have created some custom error pages and the following text at the top of my .htaccess file:
ErrorDocument 404 404.html
ErrorDocument 500 500.html
ErrorDocument 401 401.html
I have also tried,
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
ErrorDocument 401 /401.html
Both the htaccess file and the custom pages are in the root directory of the server.
The problem is that when I enter a garbage url (where I would expect to see my custom 404 page) I'm simply being redirected to my index page.
Try if your server is properly set up to parse and process .htaccess files in the first place (i.e., check if AllowOverride + AccessFileName directives are correct). For example, write some stuff in that you know will work and look if it actually gets executed (like a ridiculous rewrite rule). Also, look up your httpd log files for errors.
If it does get executed properly, the problem might be that your server is setup not to allow all kinds of overrides with .htaccess files. Your syntax however, is basically correct.

.htaccess custom 503 page won't work

First 3 Lines of my .htaccess file look like that:
ErrorDocument 403 /wartung/404.html
ErrorDocument 404 /wartung/404.html
ErrorDocument 503 /wartung/503.html
While 403 and 404 work out 503 still shows the old Server default Message. Files are all in the right directory. Also when i use Firebug i and click on the Network Request which results in 503 the "Answer" Tab shows my new 503 page but the browser windows shows the old one?
Any ideas about that? Server is some linux with apache 2.
Thanks in advance,
i3
Are you sure this isn't just some caching problem in your local browser? Have you tried clearing your cache and reloading the page?

Resources