Created
August 11, 2016 15:28
-
-
Save angarsky/aef144d92fedd479bba34db083618d5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_menu(). | |
*/ | |
function ftop_menu_alters_menu() { | |
$base_404 = array( | |
'page callback' => '_ftop_menu_alters_redirect', | |
'page arguments' => array(0), | |
'access callback' => TRUE, | |
); | |
// Set 404 error on not existing pages but with existing sub-url. | |
$items['players/%'] = $base_404; | |
$items['clubs/%'] = $base_404; | |
$items['countries/%'] = $base_404; | |
$items['coaches/%'] = $base_404; | |
$items['championships/%'] = $base_404; | |
$items['players-russian-league/%'] = $base_404; | |
$items['clubs-russian-league/%'] = $base_404; | |
$items['players-russia/%'] = $base_404; | |
$items['players-forwards/%'] = $base_404; | |
$items['players-midfielders/%'] = $base_404; | |
$items['players-goalkeepers/%'] = $base_404; | |
$items['players-defenders/%'] = $base_404; | |
$items['users/%'] = $base_404; | |
$items['news/%'] = $base_404; | |
$items['media/video/%'] = $base_404; | |
$items['media/photo/%'] = $base_404; | |
$items['predictions/%'] = $base_404; | |
$items['goalogram/%'] = $base_404; | |
$items['user-of-month/%'] = $base_404; | |
return $items; | |
} | |
/** | |
* @param $path | |
*/ | |
function _ftop_menu_alters_redirect($path) { | |
// Redirect user to another page when page is not found. | |
drupal_goto($path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment