Hello,

i stop for a simple code, i think.
But i don't understand why i have the problem !

I send a message to user to send back a code to redirect after to a form where he have to put personal information.

In my x.routing.yml, he have :

"x.depot_lecode:
  path: '/depot_lecode/{code}'
  defaults:
    _controller: '\Drupal\x\Controller\XController::depot_lecode'
[...]
x.formulaire:
   path: '/formulaire/{nid}/{did}'
   defaults:
      _form: '\Drupal\x\Form\formulaire'
      did: 0
[..]"

1. In the controler, my function depot_lecode (public function depot_lecode( $code = null )) test if the code is ok and redirect after to the form like : 

"$redirect = new RedirectResponse('/formulaire/' . $nid.'/'.$did);
 return $redirect->send();  "In my local dev, all is ok.
But in my vds for test (debian, php 7.1, like to a page : http://0.0.1.148/

no special message in the log.

My call to the form is not correct ?

But why in local is ok and not in vds ?

thank's for help ! 
My brain is out.
 

yonnel
Beginner in drupal 8

Comments

rutuj’s picture

if you have inherited controllerbase then you can use redirect() instead of RedirectResponse()

use Drupal\Core\Controller\ControllerBase;
  class MyController extends ControllerBase {
    public function myPageCallback() {
      return $this->redirect($route_name, $params, $options, $status_code);
    }
  }