How can I change form action link? How can I change form action in drupal 8?

In default, page not change and when my form path is /site/drupal/page, my form action is &lt;form data-drupal-selector="test" action="/site/drupal/page" method="post" id="test" accept-charset="UTF-8"&gt;.

But I want change it to other page. How can I do this ?

** Redirect not worked, see this link: Redirect after submit form
In the form submit handler, you can modify the $form['action'] value.


// Get the routename
$routename = 'My-Route';
  $url = \Drupal\Core\Url::fromRoute($routename);
  // make the redirection
  $form['#action'] = $url->toString();