Error documents

Discussion in 'General' started by Niels, Nov 24, 2009.

  1. Niels

    Niels New Member

    I get this

    Not Found
    The requested URL /sdfsdfsdf 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.12 (Ubuntu) Server at www.gnyftest.com Port 80


    But there are a 404.html in the error folder of the website. But why will it not be shown?
     
  2. till

    till Super Moderator

    Please enable the own error documents checkbox in the site settings.
     
  3. Niels

    Niels New Member

    Its done as default. But dont show error documents
     
  4. till

    till Super Moderator

    Do you use any kind of redirects in this website?
     
  5. Niels

    Niels New Member

    I have been adding some code but here are the apache2 file

    Code:
    <Directory /var/www/gnyftest.com>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    
    <VirtualHost *:80>
          DocumentRoot /var/www/gnyftest.com/web
    
        ServerName gnyftest.com
        ServerAlias *.gnyftest.com
        ServerAdmin webmaster@gnyftest.com
    
        ErrorLog /var/log/ispconfig/httpd/gnyftest.com/error.log
    
        ErrorDocument 400 /error/400.html
        ErrorDocument 401 /error/401.html
        ErrorDocument 403 /error/403.html
        ErrorDocument 404 /error/404.html
        ErrorDocument 405 /error/405.html
        ErrorDocument 500 /error/500.html
        ErrorDocument 503 /error/503.html
    
        <Directory /var/www/gnyftest.com/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
        <Directory /var/www/clients/client6/web15/web>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    
        # php as fast-cgi enabled
        <Directory /var/www/gnyftest.com/web>
            AddHandler fcgid-script .php .php3 .php4 .php5
            FCGIWrapper /var/www/php-fcgi-scripts/web15/.php-fcgi-starter .php
            Options +ExecCGI
            AllowOverride all
            Order allow,deny
            Allow from all
        </Directory>
    
    #
    #new code start
    <IfModule mod_rewrite.c>
            RewriteEngine on
    
            RewriteCond %{http_host} ^gnyftest\.com [nc]
            RewriteRule ^(.*)$ http://www.gnyftest.com$1 [r=301,nc]
    
            RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.gnyftest\.com [nc]
            RewriteRule ^(.*)$ http://%1.gnyftest.com$1 [r=301,nc]
    
    
            RewriteCond %{REQUEST_URI} !^/sd_
            RewriteCond %{HTTP_HOST} !^www\.gnyftest\.com [NC]
            RewriteCond %{HTTP_HOST} ^([^.]+)\.gnyftest\.com
            RewriteRule (.*) /sd_%1/$1 [L]
    
                  RewriteCond %{HTTP_HOST}   ^gnyftest\.com [NC]
            RewriteRule   ^/(.*)$ $1
              </IfModule>
    #new code end
    
    
    
    
    </VirtualHost>
    
    
     
  6. Norm

    Norm New Member

    Getting own error documents.

    This is what I had to do on my Ubuntu 9.10 server to get the 'own' error documents to show.

    Edit the file

    /etc/apache2/conf.d/localized-error-pages

    Scroll down to the section

    # The internationalized error documents require mod_alias, mod_include
    # and mod_negotiation. To activate them, uncomment the following 30 lines.

    <IfModule mod_negotiation.c>
    <IfModule mod_include.c>
    <IfModule mod_alias.c>

    Alias /error/ "/usr/share/apache2/error/"



    Then change the Alias line to something like...

    Alias /errors/ "/usr/share/apache2/error/"

    So that the alias is something other than /error/

    Save the edit then reload Apache

    /etc/init.d/apache2 reload

    Then if you have selected 'own' documents in the create site section of the ISPConfig you should get the error documents read in from /web/error/

    If you untick this 'own' document box and save (then wait a minute or so) you will get the normal apache errors.

    Maybe someone will come up with a way to retain the localized language pages because my kludge will probably break that bit. But it works for me. I make everybody read English. :)

    Norm
     
  7. till

    till Super Moderator

    If you dont use redirects, the error documents will work. But the problem with redirects is that apache expects the error documents in a relative fo,der to the redirect target. So you might have to create a symlink "error" then from your redirect target dir to the error directory of the website.
     

Share This Page