Created
October 7, 2019 15:11
-
-
Save Pathologic/464521f7a52e4a78432ea79475c0f151 to your computer and use it in GitHub Desktop.
rertert
This file contains 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
<?php | |
if ($modx->event->name == 'OnWebPagePrerender') { | |
$_url = parse_url($_SERVER['REQUEST_URI']); | |
if($modx->resource->isfolder && !preg_match("/\/$/", $_url['path'])) { | |
$id = $modx->resource->id; | |
$url = isset($_url['query']) ? $modx->makeUrl($id, '', $_url['query']) : $modx->makeUrl($id); | |
$modx->sendRedirect($url, ['responseCode' => 'HTTP/1.1 301 Moved Permanently']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment