One of the most useful component on Joomla 2.5 is Redirect component. It records all requests which produce 404 error and allow you to specify the correct url. However the component lacks in many areas specially when you want to do redirect of multiple similar urls using regex. etc. And if you are migrating your component code and want to redirect certain urls, this component may not be useful. But since it is code, it can be handled very well using your code itself. Here comes the method that can set permanent redirect without using .htaccess. Use the following code to permanent redirect requests from your component:

$app = JFactory::getApplication();
$app->redirect(url, '', 'message', true);

where url is your Joomla url. If you want to display a message, you can use second parameter for the same.

You can use this method to fully control what you want to display without effecting search engine rankings.