I have page with form which. It is working perfect, after form submitted it is replaced with "thank you" message. Initially form is accessible by url
Short answer: The client should add the query parameter when submitting the form data (e.g. in the
action parameter of the
Explanation: The server is responding to a request to a particular URL. There is no way for the server to "change the URL" of the request. The only thing the server can do is ask the client to send another request to a different URL by returning a redirect. The problem with this approach, as you mentioned, is that the form data will be lost. You could save the form data using cookies or some similar mechanism, but it's much easier to just have the client submit the form to the correct URL in the first place.