Always use get_permalink( $post_id )
to get the URI of a post. It takes care of changed permalink structures and SSL.
Be aware that the similar named function the_permalink()
does not accept a parameter. To get the permalink of a custom post type (or a regular post outside of the loop) you have to use get_permalink()
.