Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post

    how to test custom error messages

    Can anyone tell me how I can test out custom error messages I have created for my website, the site is running on an Apache web server. At the moment there is a 400.shtml file up there which is calling a 400.htm file.

    What I have just now.......
    www.ayrshireminis.com/400.html

    Many Thanks,
    Picco

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Generally helps if you give us the right address.

  • #3
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    LOL - yea, good one :-)

    Have you ever done this before? I just wondered if there was a good way to test all the different types out or if it is just a case of put them up on the server and hope they do not appear :-)

    Annoyingly can't get my <div> to center on that Error Page - http://www.ayrshireminis.com/400.htm ......

    Picco

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    just set up a PHP page and send the error using the header function.

    PHP Code:
    <?php
    header
    ("HTTP/1.1 400 Bad Request");
    header("Status: 400 Bad Request");
    ?>
    If you've set up your .htaccess right, it should redirect you to your ErrorDocument.

    I've not actually done it before, but it's how you do it with HTTP 400, so is worth a shot.

  • #5
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    ok, that's great. I created a page that has just that code in it www.ayrshireminis.com/400test.php

    After googling for the "No input file selected" error I get I found I should enter three lines in my .htaccess file, my .htaccess file now looks like:

    Code:
    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName ayrshireminis.com
    AuthUserFile /home/ayrshire/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/ayrshire/public_html/_vti_pvt/service.grp
    AddHandler application/x-httpd-php5 .php
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteRule ^.+.php$ /bogusfile
    This does not work, if I change /bogusfile to /400.htm it works, but that's not using my 400.shtml file???

    Picco

  • #6
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Then why don't you set it to /400.shtml then? -.- Where is that file, anyway? I can't find it.

    BTW, 404 on your test.

  • #7
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    i tried setting it to 400.shtml, but it just gave me a 404. Problem is I don't want to set it to 400.shtml, I want it to detect a 400 error and show the 400 error page, same for a 404 error.

    i don't know where in the following lines it says that it pertains to a 400 error:

    Code:
    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteRule ^.+.php$ /bogusfile

  • #8
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Why don't you just use .html or .php? There's no need for includes here, as it's a standalone page.

    You shouldn't be using rewrite? You're using an ErrorDocument to handle the error, so the code should be
    Code:
    ErrorDocument 400 http://www.ayrshireminis.com/400.shtml
    which is similar to the 404 one, which is
    Code:
    ErrorDocument 404 http://www.ayrshireminis.com/404.shtml
    Last edited by Apostropartheid; 11-28-2007 at 09:21 PM.

  • #9
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    took those three lines out and replaced it with the ErrorDocument line you provide, but if you go to: http://www.ayrshireminis.com/400test.php you'll just get a 'No input file specified.' error.....

    This is 400.shtml
    Code:
    <!--#include virtual="400.htm"-->
    and this is 400.htm:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>AyrshireMinis.com - a Mini E-Community</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
    <META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="EN">
    <META NAME="revisit-after" CONTENT="14 days">
    <META NAME="robots" CONTENT="all">
    <META NAME="Author" CONTENT="Craig Richard Morton">
    <META NAME="Copyright" CONTENT="AyrshireMinis.com 2007">
    <link rel="stylesheet" type="text/css" href="/mini/inc/style.css">
    </HEAD>
    <BODY>
    <br><br><br><br>
    <div style="margin-left: auto; margin-right: auto; margin-top: 100px; width: 600px; padding: 10px; border-style: dashed; color: #FFFFFF; font-family: Verdana; font-size: 8pt;">
    	<div style="font-size: 28pt; text-align: center;">AyrshireMinis.com</div>
    	<br>
    	Sorry, there has been an error.<br><br>
    	This error (400 bad request), means that a request for a URL has been made but the server is not configured or capable of responding to it. This might be the case for URLs that are handed-off to a servlet engine where no default document or servlet is configured, or the HTTP request method is not implemented.
    	<br><br><br>
    	If this error persists, please contact the Administrator at <a href="mailto:info@ayrshireminis.com?Subject=400 Error" style="color: #FFFFFF; font-weight: bold;">info [ AT ] ayrshireminis [ DOT ] com</a>
    	<br><br><br>
    </div>
    </BODY>
    </HTML>
    any ideas why i'd get that error?

  • #10
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    You've done something really weird to your .htaccess...404 just ignores everything and displays its 404, but Firefox comes up with a lot of stuff about directives. Try taking everything out and stick it into a file, and then try?

  • #11
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    Sorry mate, I gave you the wrong URL. The URL for that test script is http://www.ayrshireminis.com/mini/400test.php - try that......nothing???

    this is my entire .htacess file right now:

    Code:
    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    AuthName ayrshireminis.com
    AuthUserFile /home/ayrshire/public_html/_vti_pvt/service.pwd
    AuthGroupFile /home/ayrshire/public_html/_vti_pvt/service.grp
    AddHandler application/x-httpd-php5 .php
    ErrorDocument 400 http://www.ayrshireminis.com/400.shtml

  • #12
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    how do you mean taking everything out?

  • #13
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Just take it out, everything, apart from the ErrorDocument line. Then try it. Replace it afterwards.

  • #14
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    No, nothing......took EVERYTHING out the htaccess file except the ErrorDocument line. Also tried taking the ErrorDocument line out then refreshing. :-(

    http://www.ayrshireminis.com/mini/400test.php

    I would have thought when I created a *.shtml document in my Control Panel on the server it would have amended my .htaccess file to have the ErrorDocument line in it.

    Any other ideas as to what this isn't showing?

  • #15
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,097
    Thanks
    15
    Thanked 1 Time in 1 Post
    also.....just added in another line:

    Code:
    ErrorDocument 404 http://www.ayrshireminis.com/404.shtml
    so surely going to a non-existent URL should fire up that Error Doc?

    Picco

    :-)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •