I need to use current visitor’s city name in URLs
I have added city name into Router::scope(’/’.LOCALITY.’/’, function (RouteBuilder $routes) which is working fine. But I want if any one enter my domain like www.abc.com I need to redirect user to their current city name Like - www.abc.com/London/categories/view/23
So what is best way to redirect vistor and on which file i need to check city and write redirect code.
Please help me.
If you want to do this only when a visitor enters www.abc.com instead of some subpage, then you should simply add the locale search functionality inside of the controller action that is under “/”.
I’ve done some pretty hacky things along those lines… routing /* to a controller that then redirects (or just runs other actions as inline methods) to other actions or controllers based on the parameters passed. tbh, I did this back in the 2.x world and don’t know about 3.x But the nice thing was that you could set up exceptions in the router config to /*