How to change non-www to www in CentminMod

Share this post to your friends !

SystemMen - How to change non-www to www in CentminMod? During the operation of my blogs, I may have to move them several times between servers. Due to financial problems or internet speed problems.

If your website is running https://www.yourwebsite.com and when you change server to CentminMod, it is changed to https://yourwebsite.com. What will you do?

By default, when you create a WordPress website, it will configure your website to run non-www.

Change non-www to www for the website in CentminMod

how-to-change-non-www-to-www-in-centminmod How to change non-www to www in CentminMod
Change non-www to www for website in CentminMod.

For example, my website, systemmen.com. You will need to open the vhost configuration file for this website, with the following command.

Replace your domain in the command below.

nano /usr/local/nginx/conf/conf.d/systemmen.com.ssl.conf

Then you look to this paragraph.

#x# HTTPS-DEFAULT
 server {

   server_name systemmen.com www.systemmen.com;
   return 302 https://systemmen.com$request_uri;
   include /usr/local/nginx/conf/staticfiles.conf;
 }

server {
  listen 443 ssl http2;
  server_name systemmen.com www.systemmen.com;

Change it to.

#x# HTTPS-DEFAULT
 server {

   server_name systemmen.com www.systemmen.com;
   return 301 https://www.systemmen.com$request_uri;
   include /usr/local/nginx/conf/staticfiles.conf;
 }

server {
  listen 443 ssl http2;
  server_name systemmen.com www.systemmen.com;

And then reload the Nginx service. Here, you do not need to restart the Nginx service to prevent unnecessary downtime for other websites.

service nginx reload

To be sure, you can open the terminal and type the following command to check if your website has been redirected to www.

curl -I http://yourwebsite.com

The result.

HTTP/1.1 301 Moved Permanently
Date: Tue, 30 Jul 2019 09:42:40 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://www.yourwebsite.com/
Server: nginx centminmod
X-Powered-By: centminmod

You need to pay attention to the line.

HTTP/1.1 301 Moved Permanently

That line shows that you have successfully configured www for your website. if you get the 200 code returned, that is the configuration you failed.

Conclusion

It’s just a small trick, but it can help your website run www as you wish. For example, my website will be https://www.systemmen.com. Hope this article helpful for you.

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.


Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.