Jump to content

Prestashop 1.6 Header Location


Recommended Posts

Hi I write my module and I want add redirect to login page: index.php?controller=authentication

I add function with: header("Location: index.php?controller=authentication");

and also tried do this with this: Tools::redirect('authentication.php');


Every time is error like:

This web page has a redirect loop ERR_TOO_MANY_REDIRECTS


Any tips?

Edited by theDoris (see edit history)
Link to comment
Share on other sites

It is saying too many redirect because you are calling redirect function even on login page.

Try below code.

 

if((strpos($url,'login')!==false) || (strpos($url,'authentication')!==false))
$page='loginpage';
else
   $page='otherpage';
   if (!$this->context->customer->isLogged() && $page != 'loginpage'){ 
Tools::redirect('authentication');
   }
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...