To retrieve your own organization’s Salesforce instance’s URL, and not the visual force URL, you can use this function:
Want to learn Salesforce from basics! Here's the right video for you on Salesforce provided by Intellipaat:
Let’s understand what this function does:
Methods of this class can be used to create links to objects in your Org.
Regardless of the context, this method returns the same domain for your Org.
A string representation of the current URL can be returned by this method.