htaccess + 404 leads to ignoring of custom error documents

Discussion in 'Bug Reports' started by Gerry, May 21, 2008.

  1. Gerry

    Gerry New Member

    Our custom error documents are defined globally as follows:
    Code:
    Alias /cust_err_doc/ "/var/http/"
    ErrorDocument 301 /cust_err_doc/errors/301.php
    ErrorDocument 302 /cust_err_doc/errors/302.php
    ErrorDocument 400 /cust_err_doc/errors/400.php
    ErrorDocument 404 /cust_err_doc/errors/404.php
    ErrorDocument 403 /cust_err_doc/errors/403.php
    ErrorDocument 500 /cust_err_doc/errors/500.php
    
    When for example the following htaccess is in place and index.php is missing, the custom 404 error gets ignored and shows the default one (with LiteSpeed signature):
    Code:
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{http_host} ^domain.tld [nc]
    RewriteRule ^(.*)$ http://www.domain.tld/$1 [r=301,nc]
    
    RewriteRule ^cms$ /cms/ [r=301,nc]
    
    RewriteRule ^(en|fr|nl)?/?([a-z0-9\-/_]+)?(.htm)?$ /index.php?ls=$1&page=$2
    
    RewriteCond %{REQUEST_URI}   !^/plugins/
    RewriteRule .html$ /index.php?ls=en&page=
    
    ErrorDocument 404 /page-not-found.htm
    
  2. mistwang

    mistwang LiteSpeed Staff

    If "/page-not-found.htm" does not exist, LSWS will show the default error page.
    Either remove

    ErrorDocument 404 /page-not-found.htm

    or make it available.

Share This Page