{!$Site.CurrentSiteUrl}
{!$Site.CurrentSiteUrl}
Returns the value of the site URL for the current request (for example, http://myco.com/ or https://myco.force.com/prefix/).
LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))
LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))
Will give you the salesforce base URL for use by Salesforce users
If you store the URL as relative URL in a custom field (works inside Salesforce) and when rendering via VF for external users, use String Manipulation to append the external URL prefix.