Customizing Error pages?
Hi List, I'm moving a static HTML site to Zope, and one of the results of this is that many, many links are changing. What I'm looking for is someway to catch all NotFound Errors, and at the very least, display a small explanation regarding our upgrading, with a link to the root of the new site. What I would like at the most would be to have a script that would check what URL they came in on, consult a translation table, and put up a page with the new link, and an auto refresh (part of this would be some kind of meta tags to tell search engines that the address had changed). Another handy thing would be logging all these errors, as well as their referrers, so I could go through and contact webmasters who have linked to us. Basically, what I need is someway to direct all notfound errors to a script. Thanks, Alec Munro
On Fri, Jan 09, 2004 at 11:09:47AM -0400, Alec Munro wrote:
Hi List,
I'm moving a static HTML site to Zope, and one of the results of this is that many, many links are changing. What I'm looking for is someway to catch all NotFound Errors, and at the very least, (snip)
Modify standard_error_message. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's SEDUCTIVE PLUMBER MONSTER! (random hero from isometric.spaceninja.com)
Alec Munro wrote at 2004-1-9 11:09 -0400:
I'm moving a static HTML site to Zope, and one of the results of this is that many, many links are changing. What I'm looking for is someway to catch all NotFound Errors, and at the very least, display a small explanation regarding our upgrading, ...
When you use Apache in front of Zope (recommended), you can use Apache's "rewrite maps" to map old to new links. -- Dieter
Dieter Maurer wrote:
Alec Munro wrote at 2004-1-9 11:09 -0400:
I'm moving a static HTML site to Zope, and one of the results of this is that many, many links are changing. What I'm looking for is someway to catch all NotFound Errors, and at the very least, display a small explanation regarding our upgrading, ...
When you use Apache in front of Zope (recommended), you can use Apache's "rewrite maps" to map old to new links.
Yeah, that's what I ended up with. Looks like this, for anyone interested: RewriteMap old_new txt:/var/www/html/rewrite_map.txt RewriteCond ${old_new:%{REQUEST_URI}|none} !=none RewriteRule ^.*$ http://%{HTTP_HOST}${old_new:%{REQUEST_URI}} [R=permanent,L] Where rewrite_map.txt is a text file that looks something like this: /old_dir/old_file1 /new_dir/new_file1 /older_dir/old_file2 /new_dir/new_file2 I hope someday this save someone else some time. Thanks for everyone's suggestions. Alec
Actually, Apache has a special directive for this, "ErrorDocument". example: ErrorDocument 404 /path/to/page.html/or/script.cgi Note the "404" - I believe you can give different pages for different error codes. I like to use this since I think there's less overhead than for using mod_rewrite. I'm actually using this in a .htaccess file. Although I realize you've solved your problem, Alec, I hope this is helpful for someone else. I was happy when I found it. - Ann Marie On Fri, 09 Jan 2004 17:25:32 -0400, Alec Munro <alec.munro@eoascientific.com> wrote:
Dieter Maurer wrote:
Alec Munro wrote at 2004-1-9 11:09 -0400:
I'm moving a static HTML site to Zope, and one of the results of this is that many, many links are changing. What I'm looking for is someway to catch all NotFound Errors, and at the very least, display a small explanation regarding our upgrading, ...
When you use Apache in front of Zope (recommended), you can use Apache's "rewrite maps" to map old to new links.
Yeah, that's what I ended up with. Looks like this, for anyone interested:
RewriteMap old_new txt:/var/www/html/rewrite_map.txt RewriteCond ${old_new:%{REQUEST_URI}|none} !=none RewriteRule ^.*$ http://%{HTTP_HOST}${old_new:%{REQUEST_URI}} [R=permanent,L]
Where rewrite_map.txt is a text file that looks something like this:
/old_dir/old_file1 /new_dir/new_file1 /older_dir/old_file2 /new_dir/new_file2
I hope someday this save someone else some time.
Thanks for everyone's suggestions.
Alec
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Virtue of the Small / (919) 929-8687 / am@virtueofthesmall.com
AM Thomas schrieb:
Actually, Apache has a special directive for this, "ErrorDocument". example:
ErrorDocument 404 /path/to/page.html/or/script.cgi : Although I realize you've solved your problem, Alec, I hope this is helpful for someone else. I was happy when I found it.
Hi, Ann Marie, yes, it does look very useful; thanks for posting it. When time permits, I'll give it a try. Tobias
participants (5)
-
Alec Munro -
AM Thomas -
Dieter Maurer -
Paul Winkler -
Tobias Herp