I want to get the drupal system url (eg: node/12352) from URL alias content/some-content.

Tried using


but both are not working. The value of $path is retrived as following

$tid = $user->field_job_category['und'][0]['tid'];
$jobcategory = drupal_lookup_path('alias', 'taxonomy/term/'.$tid);
$path = 'content/'.$jobcategory; // content/

Is there any solution?


TMDHosting’s picture


I would suggest you checking this thread right here:


Hope this works for you.

Drupal Hosting, Free Drupal Installations, Free Module and Theme Installations, Free Upgrades, Free Drupal

janithpunna’s picture

Thanks for the reply. But that didn't solve my problem. I don't want to get the current url. I just want to get drupal path(eg: node/23423) of a specific URL alias (eg: content/title-of-some-content).

global $language;
$lang_name = $language->language ;
$user = user_load(arg(1));
$username = $user->name;
$term_alias = drupal_lookup_path('alias', 'taxonomy/term/'.$tid);

<a href="/<?php print $lang_name?>/content/<?php print $term_alias; ?>">Link to the page</a></div>

I want to get the system path of URL alias link given in last div (content/$term_alias), is that possible?

MJD’s picture

drupal_get_normal_path returns node/nid if an internal/system path exists or the alias that you input if it doesn't.

not sure why you are showing taxonomy examples but "taxonomy/term/tid" is the internal/system path of a taxonomy term...
if you have set up an alias for a taxonomy term e.g. "myterm" then I believe drupal_get_normal_path should work for that too...and return taxonomy/term/tid

janithpunna’s picture

Thanks for the replies the problem was with URL alias which gets update as per the language. Some how solved it