.htaccess custom 503 page won't work - .htaccess

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?

Related

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!

Custom 404 error redirect not working for https requests in htaccess file

I have a simple 404 redirect in a .htaccess file which works fine for Http requests:-
ErrorDocument 404 /apps/handle_error.php
The handle_error.php returns an appropriate PNG image depending on the URL path. However, when I replace the request with Https, it returns the default 404 error page and never does the redirect.
I know my SSL certificate is installed correctly as I get valid content returned for normal static pages. Is there something I am missing in my htaccess file regarding 404 error redirects for Https requests?
(A similar question was asked here but with no clear resolution)
After much soul searching I found the answer, for my specific case anyway.
My Apache2, mod_ssl and mod_rewrite was not configured correctly to work together. The default AllowOverride setting in my SSL config was set to "None" and mod_rewrite requires a minimum of AllowOverride of "FileInfo".
(To be fair, I got my answer from ServerFault)

Struggling to have .htaccess redirect on failed login

What I'm hoping to achieve is fairly simple. I have a development folder on the root of the web server which I do not want people to access without a login. If they visit a page under development and do not have a login (or try to login and fail), the .htaccess file should redirect them to an error page which in turn redirects to the homepage on a delay.
I'm using two .htaccess files to achieve this, one on the root which reads:
ErrorDocument 400 /error.php
ErrorDocument 401 /error.php
ErrorDocument 403 /error.php
ErrorDocument 404 /error.php
ErrorDocument 500 /error.php
and one in the root of the development folder which reads:
AuthType Basic
AuthName "Development Area"
AuthUserFile /home/content/44/7545744/html/_dev/.htpasswd
Require valid-user
error.php is hopefully styled like the rest of the site and the content informs the user of what type of error they experienced and contains a meta redirect.
Now, this works fine if you're already on the site and try to go to the development folder, however, if you are clicking a link to the development folder before being on the live site first and close the login window, it pops right back up at least 5 more times before showing the error page without styles.
If you'd like to see a live demo, visit ionnursing.com, then add /_dev/ to the URL. If you exit the login window, you can see the desired effect, an error page displays and after ten seconds, redirects you to the homepage. However, Google Ion Nursing and select one of the many links to the _dev folder. The login window displays multiple times before redirecting you to the error page.
I don't have very much experience with .htaccess files, so I'm guessing I'm doing something wrong. Any guidance would be appreciated.
I've already added a robots.txt file telling crawlers to ignore the _dev folder, however, I really need the redirect to work until search engines update.
.htaccess files always work with full paths. Your /error.php path might be missing the full path.
In short, instead of '/error.php' try '/path/to/error.php'.

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 problem with Chrome, but not Safari?

I have a very simple .htaccess file set up to redirect a 404 to a php script:
ErrorDocument 404 /404.php
This works as expected in Safari, but does not work in Google Chrome (on a Mac or a PC).
I have also put a 404.htm file to see if the php script was the problem, but had the same results.
Why would Chrome have a different experience over Safari for this? I expected the .htaccess file to be a server-side redirect, so there shouldn't be any browser issues.
(All cache was cleared on all browsers before testing as well)
Chrome displays specific error messages for 404 an such, you'll have to disable it manually in its options:
http://www.google.com/support/chrome/bin/answer.py?answer=95671

Resources