Throughout this period , Bosnia and Herzegovina was never an independent country , as it belonged to the Ottoman Empire until 1875 , before it was then annexed by Austria-Hungary until the First World War , after which it became a part of Yugoslavia .