Im using this Joomla 1.5 plugin to do redirects. Works great but it returns a “303 see other” redirect status instead of the SEO friendly 301
Is there anything that can be done to the below code for the plugin to make it a 301 redirects?
<?php
/**
* JRedirect plugin
*
* @author Ross Farinella
* @version 1.0.0
* @license GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
global $mainframe;
$mainframe->registerEvent('onAfterRoute', 'plgSystemCheckJRedirect');
/**
* Checks to see if the current URL being requested is one of the "special" URLs
* and redirects the application as necessary
*/
function plgSystemCheckJRedirect()
{
global $mainframe;
// get the plugin parameters
$tmp = JPluginHelper::getPlugin("system","jredirect");
$params = new JParameter($tmp->params);
// get the current URI
$current = JRequest::getURI(); // "/something.html"
$urls = $params->get('urls');
$urls = explode("\n",$urls);
foreach($urls as $url)
{
// get the user-entered urls
list($toCheck,$toRedirect) = explode("|",$url);
// check if we're at this url
if($current == "/".$toCheck) {
// do the redirect
$mainframe->redirect($toRedirect);
}
}
}
?>
According to the Joomla documentation (or rather, the source), you should be able to do so by changing
to
So: