How to check if page exists using page alias in D7? In D7, how do I check whether a page exists by page alias? I've found some guy asking the same very question but I have problems with using menu_valid_path() (or drupal_valid_path() in D7) function. It always returns TRUE, no matter how weird a path I pass to it. Here is a sample code:

if(drupal_valid_path($GLOBALS['base_url'] . '/contacts')) //this exists
{
    print_r('Exists!');
}
if(drupal_valid_path($GLOBALS['base_url'] . '/weird_alias')) //this doesn't exist
{
    print_r('Exists!');
}


I get two "exists" despite the fact that /weird_alias page doesn't exist and returns a "page not found" error. I'm extremely reluctant to use drupal_http_request() because there are a lot of unnecessary things like headers, timeouts etc. Shouldn't there be an easier way to check internal paths?
If you look at the code for drupal_valid_path() it passes the alias through url_is_external(), which considers paths with a http:// prefix to be external. The function defaults to allow access to these sorts of paths and simply returns that fact; it does not check whether the 'external' url exists. 

Since you're adding $GLOBALS['base_url'] to the alias it will appear to be external; you just need to pass the alias into the function without the base URL attached:

if(drupal_valid_path('weird_alias')) {
  // This code is never run
  print_r('Exists!');

}