How to change non-www to www in CentminMod

by Daniel Pham
Published: Updated:

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 and when you change server to CentminMod, it is changed to 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

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

For example, my website, 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/

Then you look to this paragraph.

 server {

   return 302$request_uri;
   include /usr/local/nginx/conf/staticfiles.conf;

server {
  listen 443 ssl http2;

Change it to.

 server {

   return 301$request_uri;
   include /usr/local/nginx/conf/staticfiles.conf;

server {
  listen 443 ssl http2;

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

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
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.


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

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.