I wants to change my articles page URL and add a query string parameters for all articles content.
Existing URL:: http://example.com/articles/test
Expected URL:: http://example.com/articles/test?q=blog
I have tried below code but page redirecting too many times.
$current_path = Drupal::service('path.current')->getPath(); $alias_path = Drupal::service('path.alias_manager')->getAliasByPath($current_path); $path = DrupalCoreUrl::fromUserInput($alias_path, array('query' => array('q' => 'web')))->toString(); $response = new RedirectResponse($path); $response->send(); return;