Magetno 2 base url 302 redirection

Hi I am trying to implement add extra key to base url example my base url:: if user click on any key with base_url like below user entered url :: site need set new theme if pawan key found my custom table. If not fount i need to redirect to home page or base url means site will work regular format if key found only new theme will assign can you please tell how can achieve this.

Present my site if i click it redirecting to i am not redirecting but it redirecting automatically i have installed wild card ssl like *

can any one tell how to stop that automatic redirection