How do I create a route with a query string?
You cannot create a route based on the query string, but you still can retrieve query string values in your code:

amu_hal.publicationsPerYear:
  path: '/publications/{year}'
  defaults:
    _controller: '\Drupal\amu_hal\Controller\AmuHalController::publicationPerYear'
    _title: 'publicationPerYear'
    year: 2016
  requirements:
    _permission: 'access content'




public function publicationPerYear($year) {
  $url = \Drupal::request()-&gt;query-&gt;get('url') ?: 'default';
}