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.
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)
You can redirect from homepage to any product by adding this code in:
catalog/controller/common/home.php
$this->response->redirect($this->url->link('product/product', 'product_id=50', ''));
Where 50 is your product id. This is on Opencart 2.0.1.1. I did this because I only sell one product, hope this helps.
for redirection this may also work in opencart
$this->redirect($this->url->link('account/customregister', '', 'SSL'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With