Opencart URL Redirection

I made a special 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 pointing to the default registration module (route = account / register). I know that I can edit the .htaccess file to do URL redirection or rewriting, but I want to do this with php. Does anyone know if there is some class / function or some code that I can put on the extension to automatically redirect users to the new URL?

Thanks to everyone in advance.

Ps I can not change the main files, and I would not edit .htaccess.

+4
source share
3 answers

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

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

only inside the declaration of the index() method (so use this as a vQmod search and use the after position)

+9
source

You can redirect from the home page to any product by adding this code to:

directory / controller / shared / home.php

 $this->response->redirect($this->url->link('product/product', 'product_id=50', '')); 

Where 50 is your product identifier. This is on Opencart 2.0.1.1. I did this because I only sell one product, hope this helps.

+2
source

for redirection this can also work in opencart

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

All Articles