Jump to content
onklmaps

Avoid redirect for a module front controller

Recommended Posts

I am building an api for my PrestaShop module using a module FrontController.

class mymoduleModuleFrontController extends ModuleFrontController
{
    public function init()
    {
       echo "Hello world"; 
    }
}

The controller runs fine under mydomain.com/index.php?fc=module&module=mymodule&controller=api

However.. When I change shop domain to for example mynewdomain.com, PrestaShop automatically redirects me from mydomain.com/index.php?fc=module&module=mymodule&controller=api to mynewdomain.com/index.php?fc=module&module=mymodule&controller=api.

How can I disable automatic redirect for a PrestaShop ModuleFrontController?

I even tried to make it independent of the PrestaShop controller-system by accessing a PHP-file in my module-dir:

require_once(dirname(__FILE__).'/../../config/config.inc.php');
require_once('mymodule.php');

Even that last approach redirects me to the new domain.

Is there any way to disable PrestaShop redirects for a script?

Share this post


Link to post
Share on other sites

Oui c'est +/- redirigé de manière forcé si tes réglages SEO forcent la redirection

Tu peux passer outre celà normalement lorsque tu soumets en POST, ce qui me parait convenir à ton usecase.

Enfin il serait bon de parler dans la langue de la section du forum que tu as choisit

Share this post


Link to post
Share on other sites

I am sorry, I posted in wrong forum. I reposted in international forum now:

https://www.prestashop.com/forums/topic/910451-avoid-redirect-for-a-module-front-controller/

 

Quote

Tu peux passer outre celà normalement lorsque tu soumets en POST, ce qui me parait convenir à ton usecase.

 

I think this might help me with this issue. Yes you are right I am sending POST to the controller/script. I will test it. 

Do you mind posting your reply in my post in the international forum?

Thanks!

 

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More