From 1c1c7c8d15cd073336b314262b3fb27a6bc885bb Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Wed, 28 Sep 2011 20:32:41 +0000 Subject: [PATCH] [gh-203] Merging from testing into staging git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@1089 20a16fea-79d4-4915-8869-1ea9d5ebf173 --- sites/all/modules/unl/unl.module | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sites/all/modules/unl/unl.module b/sites/all/modules/unl/unl.module index 9a68fc31..c4438828 100644 --- a/sites/all/modules/unl/unl.module +++ b/sites/all/modules/unl/unl.module @@ -932,6 +932,33 @@ function unl_init() { drupal_goto($primary_base_url . current_path()); } } + _unl_handle_directory_index(); +} + +/** + * Custom function called by unl_init() to redirect users from + * a non-existant some/path/index.html to an existing some/path. + */ +function _unl_handle_directory_index() { + $path = current_path(); + + if (!in_array(basename($path), array('index.html', 'index.htm', 'index.shtml'))) { + return; + } + + if (drupal_lookup_path('source', $path)) { + return; + } + + if (drupal_lookup_path('source', dirname($path))) { + drupal_goto(dirname($path)); + return; + } + + if (dirname($path) == '.') { + drupal_goto('<front>'); + return; + } } /** -- GitLab