I create a custom module in Drupal 8. It install/uninstall smoothly. But when I try to access that module then I'm getting that message

"Page Not Found." -
Failed to load resource: the server responded with a status of 404 (Not Found)

For debuging I made these entries in my setting.php file.

ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$conf['error_level'] = 2;

But getting no luck. Is there any other ways to debug my code in drupal 8.

Here is my routing file code:

  path: '/admin/custom_module'
    _controller: '\Drupal\custom_module\CustomModuleController::custInformation'
    _title: 'Custom Module Title'
    _permission: 'access information'

  path: '/custom_module'
    _title: 'Custom Module Title'
    _controller: '\Drupal\custom_module\CustomModuleController::custInformation'
    _permission: 'access information'

and link.menu.yml file code:

  title: 'Custom Module Title'
  parent: system.admin
  description: 'Brief description.'
  route_name: custom_module.admin
  title: 'Custom Module Title'
  route_name: custom_module.site_page
  menu_name: footer
  enabled: 0

& controller file

namespace Drupal\custom_module\Controller;

use Drupal\Core\Controller\ControllerBase;

 * Controller routines for contact routes.
class CustomModuleController extends ControllerBase {

   * Render a list of entries in the database.
  public function custInformation() {
    $header = array('Name');
        $rows[] = array("John");
    $content['table_brief'] = array(
      '#type' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#empty' => t('No entries available.'),
    return $content;
  • Could you provide the routing and corresponding controller file? I think the problem is just some missmatching in class or method names.
    – schlicki
    Commented Jul 10, 2015 at 12:01
  • Got the same error. @Rahul: Did u get any solution?
    – Kiran Tej
    Commented Dec 11, 2015 at 10:23

1 Answer 1


There are several reason for "Page not found." I'm sharing the some points may be helpful to someone who face same issue.

  1. Check your php log file. if there is some php error in your code, it also cause page not found. It occur in my case.
  2. Check PHP file location, which you mention in routing file. Sometimes php file location not correct.
  3. Most important point, check yml file for indentation, if indentation is not proper it also cause "page not found" issue.
  4. Check recent log message and try to sort out warning/error if any

@Kiran Tej, my issue has been resolved. In my case by mistake I placed the file directly inside the 'src' folder. Please read above points may be it helpful to you if your issue not resolved yet.

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.