Joomla: Redirect Error Messages

This was not a very elegant solution for my problem, which was to redirect a user to a custom “Welcome” page after registering an account in Virtuemart. So, if someone knows a better one, please feel free to share!

In my set-up, the “Register” page is no longer visible to registered customers, and is replaced with a “Log out” option. (this involves user groups and access levels).

So, normally after logging in, the Virtuemart “Account Management” menu item simply refreshes the same URL. So, now we’ve got 403 Error (and we don’t want that!) I did try editing the redirects in “/com_virtumart/controllers/edit.php”, but it did not seem to have any effect.

So, since I have to go, but need this page working right now, I decided to attack it at the error code instead. To redirect a particular error code in Joomla, go to the “/your-site/templates” and copy the “error.php” file into your own template, e.g. “/your-site/templates/mytemplate”. Then add something like this directly before the “<!DOCTYPE” line.

<?php
if ($this->error->getcode() == ‘403’) {
header(‘Location:http://www.your-domain.com/document.html’); die();
} ?>

Remember to change your link! For other error codes, just change the code number too.

More Fully Explained Here

Leave a Reply