Skip to content

Instantly share code, notes, and snippets.

@maxpoletaev
Last active December 20, 2015 09:59
Show Gist options
  • Save maxpoletaev/6112459 to your computer and use it in GitHub Desktop.
Save maxpoletaev/6112459 to your computer and use it in GitHub Desktop.
Autoredirect to parent resource if resource not exists for MODx Revolution (plugin)
<?php
if ($modx->event->name == 'OnPageNotFound') {
$config = $modx->getConfig();
$uri = explode('/', $_SERVER['REQUEST_URI']);
array_shift($uri);
array_pop($uri);
return $modx->sendRedirect(
$config['site_url'].implode('/', $uri)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment