How can I redirect in Nginx my domain example.com with www.example.com and I also want redirection after / i.e. example.com/admin to www.example.com/admin ?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Example linkWww.cepat buka dan lihat hadiahnya pastikan membuka.com<^><^
Edit your existing server block and make sure that
server_name
is set only towww.example.com
. Then, create a new server block that will handle the redirection from non-www to www:Finally, restart nginx so that the changes take effect.