Jump to content

How to redirect from Home page to different URL


Janeric

Recommended Posts

Hi,

 

I can't figure out how can I redirect  my home page to different URL. I have found tutorials how to redirect to product or catagory page but these doesn't work in my case.

 

For example:

 

When someone goes to myprestashop.com they will be redirected to myprestashop.com/differentpage

 

Sorry, if it is very simple, I'm new to prestashop and ecommerce.

 

 

Link to comment
Share on other sites

 

you can do that in following Home Page controller file

 

/controllers/front/IndexController.php

 

or (recommended)

 

/override/controllers/front/IndexController.php

 
You can add redirect into override method init().

 

 I have tried

 

class IndexController extends IndexControllerCore

{

 

public function initContent()

{

Tools::redirect('autoparts/');

 

}

}

 

but when I go to my page, instead myprestashop.com/autoparts, it directs me to myprestashop.com/index.php?controller=autoparts/. I can't figure out how to lose the "index.php?controller=" part from the URL.

Link to comment
Share on other sites

but when I go to my page, instead myprestashop.com/autoparts, it directs me to myprestashop.com/index.php?controller=autoparts/. I can't figure out how to lose the "index.php?controller=" part from the URL.

 

 

 

The URL you passed to Tools::redirect() is incorrectly. You need to get the correct URL and then pass the correct URL to that method call.

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...