This question has been answered by tcbutterworth. See the first response.
<?php
// find your $resource_id
$url = $modx->makeUrl($resource_id);
$modx->sendRedirect($url, array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
$requestParts = explode('/', $requestURI, 3);
if (count($requestParts) >= 1)
{
if ( $requestParts[1] == 'product' )
{
$_GET['action'] = 'product';
$modx->sendForward(6);
}
if ( $requestParts[1] == 'review' )
{
$_GET['action'] = 'review';
$modx->sendForward(7);
}
}
else
$modx->sendForward(3);
<?php
// Retrieve current URL
$search = $_SERVER['REQUEST_URI'];
if($search[0] == '/'){
$search = substr($_SERVER['REQUEST_URI'], 1);
}
// Search TV values table for matches
$sql = 'SELECT tmplvarid, contentid, value FROM modx_site_tmplvar_contentvalues WHERE tmplvarid = 19 AND value LIKE "%'.$search.'%"';
// Found? Redirect it with a 301 status code
foreach($modx->query($sql) AS $row){
$modx->sendRedirect($modx->makeUrl($row['contentid'],'','','full'),array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
}RewriteEngine On RewriteRule (.*)\.asp $1.html [R=301]
Or just use Redirector from package management.
Quote from: frogabog at Feb 10, 2013, 12:16 PMOr just use Redirector from package management.
The difference with the redirector component is that the client can now manage 301's in the resource itself.
Quote from: nomark at Feb 10, 2013, 02:14 PMQuote from: frogabog at Feb 10, 2013, 12:16 PMOr just use Redirector from package management.
The difference with the redirector component is that the client can now manage 301's in the resource itself.
Unfortunately a tv like that would only benefit me. My clients would never imagine themselves interested enough to know the need. So far at least.
Setting 15-30 301 redirects in one shot when migrating to MODX, I find the Redirector component is mighty handy.