After logging in the user is not directed to the homepage I noticed that when I login I get redirected to localhost/mysite/user/1 and not localhost/mysite or localhost/mysite/homepage. Why is this and what can I do about to make the user go to the homepage after logging in ?
It is a default option.
But you can redirect user to any page by using hook_form_FORM_ID_alter
Example:

 /*
* Implements hook_form_FORM_ID_alter
*/

     function YOUR_MODULE_OR_THEME_NAME_form_user_login_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
      // Alter login form and add own custom submit handler.
      array_push($form['#submit'], '_custom_user_login_form_submit');
    }



 /**
 * Custom submit handler for login form.
 */

    function _custom_user_login_form_submit($form, \Drupal\Core\Form\FormStateInterface $form_state) {
        $parameter = 'some_value';
        // Set redirect to login form.
      $form_state-&gt;setRedirect('custom_page', ['parameter' =&gt; $parameter]);
    }


For the front page default front page name is view.frontpage.page_1. So it should be

 function _custom_user_login_form_submit($form, \Drupal\Core\Form\FormStateInterface $form_state) {

          $form_state-&gt;setRedirect('view.frontpage.page_1');
        }