PDA

View Full Version : htaccess + 404 leads to ignoring of custom error documents


Gerry
05-21-2008, 06:18 AM
Our custom error documents are defined globally as follows:

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):

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

mistwang
05-21-2008, 12:19 PM
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.