How to Redirect www to non www on Nginx
I just moved from my shared hosting plan to cloud VPS on Contabo and found that the www version of my website is showing Welcome to Nginx! page. I installed Aapanel to manage and configure my website, it’s like CPANEL on shared hosting.
Here are the steps required to fix that problem:
- Login to Aapanel and click Website
2. It will show your all websites, on the website you want to configure, click Conf
3. You will see below window (Domain Manager), add www.yourdomain.com, click Add
4. After adding you will see similar to the below window.
5. From the left menu click Redirect, click Add Redirection
6. Click Source and choose the www version of your domain, on target URL type https address of your version as below.
Click Submit and you are done.
Click on the browser to make sure that your www version of the website correctly redirect to non www version as this website. Thank you.