Page 1 of 1

Custom 404 Error Page

Posted: Tue Nov 15, 2005 7:45 pm
by Pat
I created a new custom 404 Error Page called error.htm with a static page.

I also changed the .htaccess page to say

ErrorDocument 404 /error.htm

still, when I check on false pages, I still get kicked back to the index.php page. The header does check out to 404. I want the blank page with no text, not the index page.

How do I change it?

Re: Custom 404 Error Page

Posted: Tue Nov 15, 2005 7:52 pm
by garvinhicking
Are you using mod_rewrite? If yes, you need to disable mod_rewrite to get custom ErrorDocuments to work.

If that doesn't help -- what is your URL, and how exactly does your .htaccess file look like? You are modifying the .htaccess in the document root of serendipity, not within a subdirectory?

Regards,
Garvin

Posted: Tue Nov 15, 2005 8:22 pm
by Guest
I'm at

http://greennature.com/

I'm playing with modrewrite now.

I can not turn off mod rewrite. I need the custom urls to make sure that I maintain the same url structure as my former site. I just upgraded Green Nature to Serendipity from PostNuke.

it looks like this:

# BEGIN s9y
ErrorDocument 404 /index.php
DirectoryIndex /index.php
php_value session.use_trans_sid 0
php_value register_globals off

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.greennature\.com
RewriteRule ^(.*)$ http://greennature.com/$1 [R=301,L]
RewriteBase /
RewriteRule ^(article([0-9]+)\.html) index.php?/$1 [L,QSA]
RewriteRule ^(authors/([0-9]+)-[0-9a-z\.\_!;,\+\-]+) index.php?/$1 [L,QSA]
RewriteRule ^(feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-]+\.rss) index.php?/$1 [L,QSA]
RewriteRule ^({PAT_PERMALINK_FEEDAUTHORS}) index.php?/$1 [L,QSA]
RewriteRule ^(categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-]+) index.php?/$1 [L,QSA]
RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [L,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA]
RewriteRule ^archive/? index.php?url=/archive [L,QSA]
RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA]
RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]

redirect 301 /PN_Glossary.html http://greennature.com/dictionary/
redirect 301 /My_eGallery.html http://greennature.com/gallery/albums.php
redirect 301 /auctionaid http://funwithcollectibles.com

<Files *.tpl.php>
deny from all
</Files>

<Files *.tpl>
deny from all
</Files>

<Files *.sql>
deny from all
</Files>

<Files *.inc.php>
deny from all
</Files>

<Files *.db>
deny from all
</Files>

# END s9y

Posted: Tue Nov 15, 2005 9:21 pm
by garvinhicking
I think you can't use "error.htm" because this HTML location is caugt by the "[a-z0-9].html" rewrite rule!

You must use a location URL that does not match any of the URL rewriting schemes...

Regards,
Garvin

Posted: Tue Nov 15, 2005 9:55 pm
by Guest
worked like a dream, thanks gavin

Posted: Wed Jan 02, 2008 4:47 pm
by holysjit
Hi,
I tried to do exactly the same,but it doesn't work. My error page = www.thejokersweblog.nl/paginas/error.html

I tried this:

Code: Select all

ErrorDocument 404 /http://www.thejokersweblog.nl/paginas/error.html
DirectoryIndex /index.php
What do I have to do?

Posted: Wed Jan 02, 2008 6:21 pm
by garvinhicking
Hi!

You cannot use absolute URLs as errordocument handled, you'd need to use something like:

Code: Select all

ErrorDocument 404 /paginas/error.html
DirectoryIndex /index.php
Bear in mind that this might destroy your pretty URLs, permalink schemes or external plugins. Serendipity uses the 404 error handler to redirect external pages to itself.

Regards,
Garvin