3

I need to check if a url exists in a module that I am creating. How should I go about doing this? I tried to use a @get_headers() function with php, but sadly that doesn't work. I am wondering if there is a built in drupal function that I can use?

4
4

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.