How to get the full URL of a Drupal page?


I need to be grabbing the URL of the current page in a Drupal site. It doesn't matter what content type it is - can be any type of node.

I am NOT looking for the path to theme, or the base url, or Drupal's get_destination. I'm looking for a function or variable that will give me the following in full:

Either with or without (more likely) the http://.

3/3/2015 10:23:33 PM

drupal_get_destination() has some internal code that points at the correct place to getthe current internal path. To translate that path into an absolute URL, the url() function should do the trick. If the 'absolute' option is passed in it will generate the full URL, not just the internal path. It will also swap in any path aliases for the current path as well.

$path = isset($_GET['q']) ? $_GET['q'] : '<front>';
$link = url($path, array('absolute' => TRUE));
4/3/2009 8:32:37 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow