$TVname = 'oldUrl';
$current = urldecode($_GET['effective_url']);
$table = $modx->getFullTableName("site_tmplvars");
$TVid = mysql_fetch_row($modx->db->select('id', $table, "name = $TVname"))['id'];
$table = $modx->getFullTableName("site_tmplvar_contentvalues");
$doc = mysql_fetch_row($modx->db->select('contentid', $table, "value=$current and tmplvarid=$TVid"))['contentid'];
$url=$modx->makeUrl($doc);
$modx->sendRedirect($url, 1);
$TVname = 'oldURI';
$current = $_SERVER["REQUEST_URI"];
$table = $modx->getFullTableName("site_tmplvars");
$TVid = mysql_fetch_row($modx->db->select('id', $table, "name = '$TVname'"))['id'];
$table = $modx->getFullTableName("site_tmplvar_contentvalues");
$doc = mysql_fetch_row($modx->db->select('contentid', $table, "value='$current' and tmplvarid='$TVid'"))['contentid'];
$url=$modx->makeUrl($doc);
$modx->sendRedirect($url, 1);
This discussion is closed to further replies. Keep calm and carry on.