Opencart Url redirect

Frank picture Frank · Jan 8, 2013 · Viewed 31.9k times · Source

I made a custom registration module for Opencart,

my registration page has the following url:

www.mysite.com/index.php?route=account/customregister

while the default registration page url is:

www.mysite.com/index.php?route=account/register

I want to redirect users to my registration page (route=account/customregister) when users click on any link that points to the default registration module(route=account/register). I know I can edit the .htaccess file to make a redirect or a url rewriting but I want to do that by php. Do someone knows if there is some class/function or some kind of code I can put on my extension to automatically redirect users to the new url?

Thanks all in advance

P.s. I cannot modify the core files and I would not edit the .htaccess.

Answer

Jay Gilford picture Jay Gilford · Jan 8, 2013

This can be achieved with a vQmod pretty easily. You need to use a vQmod to edit the file /catalog/controller/account/register.php and put

$this->redirect($this->url->link('account/customregister', '', 'SSL'));

just inside the index() method declaration (so use this as the search for the vQmod and use the after position)