I have just started learning/working with Drupal and I am trying to build a theme for a website (something that has nothing to do with a blog other than the fact that the content is dynamically generated).

I have just installed Drupal 8.4 with the Minimal profile and created the bare structure of my theme. However, when I go to visit http://mysite I get redirected to http://mysite/users/1.

I want to create a frontpage containing a large search bar and the thumbnails of some content (if that matters in any way). I created a page--front.html.twig but I still can't get rid of the redirect from / to /users/1.

Could you please give me some advice regarding this redirect and the more general idea of implementing a custom landing page?

  • This might help, drupal.stackexchange.com/questions/195170/…
    – Kana
    Commented Nov 14, 2017 at 7:21
  • I would start with a Standard profile install, then you have a view preinstalled as landing page for the frontpage. You can then start to customize this frontpage view to show the content you want and filter it dynamically with an exposed filter.
    – 4uk4
    Commented Nov 14, 2017 at 7:47
  • @4k4 I think that's what I'll do, but could you please explain why this redirect happens? Basically why I can't have a homepage
    – Victor
    Commented Nov 14, 2017 at 7:50
  • Because the default value for the front page, set in the system site configuration, is /user/login. The Standard profile overwrites this config to point it to the installed front page view.
    – 4uk4
    Commented Nov 14, 2017 at 8:13
  • Ok, could you please write an answer explaining that so I can accept it? Because this seems to be what I was looking for!
    – Victor
    Commented Nov 14, 2017 at 8:34

2 Answers 2


This is the site default configuration:


uuid: ''
name: 'Drupal'
mail: ''
slogan: ''
  403: ''
  404: ''
  front: /user/login
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en

So if you have a Minimal install, you have to go to /admin/config/system/site-information and change the default front page.

The Standard profile overwrites this config to point it to the pre-installed front page view.


For redirection, You need to check if anything is written in .htaccess. By default after login if drupal is redirecting you to user/{uid} page and you want it on front page, then you can write below code in your custom module:

function hook_user_login($account) {
  // We want to redirect user on login.
  $response = new RedirectResponse("<front>");

For Custom design of Front page, you are going in write direction. You can write the twig code in page--front.html.twig.


  • I am not sure if I really need to write a redirection myself. It seems counter-intuitive to have to write a redirect to the front page.
    – Victor
    Commented Nov 14, 2017 at 7:34
  • The default drupal behaviour is this: User Logins -> Redirect User to www.{sitename}.{sitedomain}/user/{uid} after successful login. Commented Nov 14, 2017 at 7:52
  • Ok, but if I go to visit the homepage manually again, I'm taken there again
    – Victor
    Commented Nov 14, 2017 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.