Here is a quick snippet which helps to load the node object based on the URL alias.
//Your custom URL (alias). $my_url_alias = 'about-me'; // This line will return corresponding system path. // Lets say, '/node/15' is corresponding path '/about-me' $path = \Drupal::service('path.alias_manager')->getPathByAlias('/'.$ahurl); if(preg_match('/node\/(\d+)/', $path, $matches)) { // This will load the node object. $node = \Drupal\node\Entity\Node::load($matches[1]); }
That's it.
Happy Coding :)