How to check if a url exists on my own website
This is what fixed it:

if (!drupal_valid_path($path)) {
  // Not a system URL.
  if (!drupal_lookup_path('source', $path))  {
    // Not a path alias.
    // $path does not exist.
  }
}


Where $path is a relative url.

Source