I just created a new module but I can't manage to access it.

Here is the home.info.yml

name: Home
description: Ownzones Homepage
type: module
core: 8.x

Here is home.routing.yml

  path: '/oztest'
    _content: '\Drupal\home\Controller\HomeController::oztest'
    _title: 'Ownzones'
    _permission: 'access content'

And here is the HomeController:

namespace Drupal\home\Controller;

use Drupal\Core\Controller\ControllerBase;

class HomeController extends ControllerBase {
  public function oztest() {
    $element = array(
      '#markup' => 'Hello, world',

    return $element;

I don't see what I'm doing wrong, and when I try to access /oztest I get a message saying The requested page could not be found.

1 Answer 1


_content is no longer used, wherever you found that is outdated. Use _controller instead.

  • Thank you! So I should read every line of the changelog every time they update Drupal, right? Commented Dec 31, 2014 at 17:51
  • 1
    There are a lot of outdated D8 tutorials and documentation out there, because things changed a lot in the last year, after there was a believe that we're almost done and people wrote those tutorials and documentation. It will improve now, there aren't that many changes anymore since beta version started.
    – Berdir
    Commented Dec 31, 2014 at 23:49
  • 1
    I tried above given code by replacing _content by _controller. Still getting page not found. Have any idea?
    – Cool
    Commented Dec 23, 2015 at 11:23
  • I'm also still getting page not found
    – Amy
    Commented Jan 13, 2017 at 0:51

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.