There is no homepage URL

by Victor   Last Updated November 14, 2017 08:07 AM

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?

Tags : theming 8


Answers 1


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>");
  $response->send();
  return;
}

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

thanks

Ramdas Gaikar
Ramdas Gaikar
November 14, 2017 07:25 AM

Related Questions


Features can export everything?

Updated March 26, 2015 10:02 AM


No image style found

Updated March 29, 2015 15:02 PM


Best way to have 5 or 6 themes in one site drupal 7

Updated April 09, 2015 22:03 PM