Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.528
diff -u -r1.528 common.inc
--- includes/common.inc	17 Mar 2006 18:56:25 -0000	1.528
+++ includes/common.inc	27 Mar 2006 08:00:28 -0000
@@ -255,6 +255,9 @@
   drupal_set_header('HTTP/1.0 404 Not Found');
   watchdog('page not found', t('%page not found.', array('%page' => theme('placeholder', $_GET['q']))), WATCHDOG_WARNING);
 
+  // Keep old path for reference
+  $_REQUEST['destination'] = $_GET['q'];
+
   $path = drupal_get_normal_path(variable_get('site_404', ''));
   if ($path && $path != $_GET['q']) {
     menu_set_active_item($path);
@@ -278,6 +281,9 @@
   drupal_set_header('HTTP/1.0 403 Forbidden');
   watchdog('access denied', t('%page denied access.', array('%page' => theme('placeholder', $_GET['q']))), WATCHDOG_WARNING, l(t('view'), $_GET['q']));
 
+  // Keep old path for reference
+  $_REQUEST['destination'] = $_GET['q'];
+
   $path = drupal_get_normal_path(variable_get('site_403', ''));
   if ($path && $path != $_GET['q']) {
     menu_set_active_item($path);
