During the civil revolution of 1848, the city was annexed to the Banovina of Croatia, and the governor Josip Jelačić became governor of Rijeka. The fight over Rijeka between Croatia and Hungary was intensifying until the Croatian-Hungarian Treaty, the so called “Riječka krpica”, was signed in 1868, putting Rijeka under direct Hungarian rule. Hungary rapidly developed it into its largest maritime and port emporium.
After the fall of the Austro-Hungarian Monarchy in 1918, Rijeka and Sušak became part of the State of Slovenes, Croats and Serbs, having its capital in Zagreb, but was soon occupied by the Kingdom of Italy. Since Italy was previously not interested in Rijeka, but left it to Croatia, a transitional period followed. After D’Annunzio’s occupation in 1919 and the Free State of Rijeka in 1920, it nevertheless fell into Italian hands in 1924. Rijeka suffered a rapid economic decline and became an unimportant town. Sušak was annexed to the Kingdom of Slovenes, Croats and Serbs with capital in Belgrade and rapidly developed relying on the wider hinterland.
Apart from nearby Istria, Rijeka was the first place in the world to begin fight fascism and was, in the Second World War, a part of the anti-fascism front-line. After Italian capitulation in 1943, Rijeka and Sušak were occupied by the Germans who held them until 3 May 1945 when they were liberated. Owing to the conclusions of the Paris Peace Conference in 1947, Rijeka was once again returned to its parent country, Croatia, now a part of Yugoslavia. In 1948, the towns of Rijeka and Sušak merged into the city of Rijeka, which developed rapidly in a number of areas.
After reconstruction, Rijeka assumed the role of the main port in socialist Yugoslavia. Within the industrial structures, traditional Rijeka industries were revived: ship building, paper mill, oil refinery, the production of ship devices and engines, coke plant, textile industry, hydroelectric power plants as well as thermal power plants. Apart from the shipping companies, the crossing of five main roads leading to Zagreb, Ljubljana, Trieste, Pula and Zadar and the railroad ensured the development of the tertiary sector in Rijeka.