Created
February 9, 2011 10:13
-
-
Save zaigham/818247 to your computer and use it in GitHub Desktop.
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 | |
/* Virtual aliases | |
* Patrick Nijkamp | |
* http://www.1-vision.nl | |
* When installed create a property in the DEFAULT property set called "tvID" | |
* and fill it with the ID of the TV that hold's the old URL. | |
* Old URL's without '/' at the start. | |
*/ | |
$aliasTvId = $scriptProperties['tvId']; | |
$match = $modx->getObject('modTemplateVarResource', array( | |
'value' => substr($_SERVER['REQUEST_URI'], 1), | |
'tmplvarid' => $aliasTvId | |
)); | |
if ($match != null) { | |
header('HTTP/1.1 301 Moved Permanently'); | |
$modx->sendRedirect($modx->makeUrl($match->get('contentid')), 0, 'REDIRECT_HEADER'); | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment