You've set "Auto-redirect to Base URL" in System > Configuration > Web > Url Options.
With this configuration all requests that do not exactly match the base url will be redirected to the base url (any route paths are discarted).
Either turn this setting to No and implement the redirects in your webserver config (this is pretty easy for nginx)
or only use the correct base urls for linking to your store.
Also make sure the secure base url starts with "https://".