Drupal : Get path and verify if it’s an alias
This is how I get the current path and/or alias in Drupal:
After this code has been executed:
$path will hold the internal drupal path
$alias will hold that path alias if the path in the url is actually an alias, otherwise FALSE;
1 2 3 4 5 6 | $path_from_url = isset($_GET['q']) ? $_GET['q'] : '<front>'; $path = drupal_get_normal_path($path_from_url); if($path === $path_from_url) $alias = FALSE; else $alias = $path_from_url; |