I made some changes to the default tab layout.
The pages that have tabs have the url alias /pageName/{tab}.
In my custom tab layout webpart (copied from the default one), I'm getting the value of the tab query string, and then find the correct tab and set the ActiveTabIndex to that tab index.