How to redirect only the root path in nginx? September 25, 2023 by Tarik I got it. location ~ ^/$ { return 301 https://www.b.com/; }