Custom 404 Error Page

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Pat

Custom 404 Error Page

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Custom 404 Error Page

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

worked like a dream, thanks gavin
holysjit
Regular
Posts: 131
Joined: Sun Apr 08, 2007 9:47 am

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply