Nako is right, of course, for UA and many/most carriers. One that does not follow this pattern

though is Hawaiian Airlines for interisland flights. If you book, e.g., KOA-OGG and it's 2 segments connecting in HNL you only get 500 miles, not 2 x 500 miles (500 miles is the minimum that accrues/posts on many/most airlines no matter if the actual distance is less).