I have a series of nodes which are published on up to 7 different domains on the same single Drupal 7 install. Whilst I can use url('node/12345'); for nodes published to the current domain, I would like to create href links to the these nodes and have them link to the correct domain path.

At the moment, nodes that are not published to the current domain are just giving me href="/12345".

How do I get the URL for nodes that aren't in the current domain?

  • you could use (without path-alias) otherdomain.com/node/12345
    – rémy
    May 15, 2017 at 11:32
  • @rémy Thank you, that would work, but surely there is a way to get the path alias as well given I know the domain ID and node ID? May 15, 2017 at 11:34
  • I'm assuming you use the Domain Access module since you tagged your question as such. Please mention it in your question as well so this vital information is not missed. Did you read the module's README.txt and INSTALL.txt, and include its settings.inc in your settings.php? Domain Access is a complex module but the documentation included is awesome. May 22, 2017 at 9:17

1 Answer 1


You could try drupal_get_path_alias('node/12345') (see docs) and then exchange the domain name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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