$course_id = 123; $course = new ilObjCourse($course_id); $html_path = ilUtil::getHtmlPath($course); // $html_path would be something like: "ilias.php?baseClass=ilrepositorygui&ref_id=123&type=123"
$user_id = 456; $user = new ilObjUser($user_id); $html_path = ilUtil::getHtmlPath($user); // $html_path would be something like: "ilias.php?baseClass=ilObjUserGUI&ref_id=456"`ilUtil` is a part of the ILIAS core library.