php - Redirect Message Symfony


I am currently wondering why sometimes when redirecting in Symfony via$this->redirect($this->generateUrl()) a message is shown with "Redirecting to: myURL" and other times there is no message at all and it is immediately directed to the url without that message. I also tried the same redirect in different controller actions and in one action the ugly message was shown and in the other not. Any suggestions why this behaviour might occure and how to prevent it?


For further clearification on my scenario. I have a form flow with multiple steps and very time one step is submitted and is evaluated as valid, I redirect to the next step. I have this scenario twice in my application and in one scenario it just shows directly the next step of the form flow but in the other scenario it first shows the ugly "Redirecting to: URL" page which I cannot figure out why and is really annoying for the user experience.




This is how it should be done according to RFC2616:

The new permanent URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).

Symfony works exactly like that. It sets a body for the and later removes it if the request method was HEAD. So the request method should be HEAD if you don't want the text.

People are also looking for solutions to the problem: php - chinese character in mysql insert and phpmyadmin


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.