Nginx is redirecting www to non-www

Hi Guys,

I have created a website with ee site create domain.com --wpfc. It is working fine, but it always redirects www.domain.com to domain.com

Pingdom Tools tells me that my site is taking 300ms just for this useless redirect. How can I set it back to normal? (ie. www.domain.com goes to www.domain.com and domain.com goes to doamin.com, with no redirects)

Config File:

`server {

server_name www.thauaneclaussen.com thauaneclaussen.com;

access_log /var/log/nginx/thauaneclaussen.com.access.log rt_cache;
error_log /var/log/nginx/thauaneclaussen.com.error.log;


root /var/www/thauaneclaussen.com/htdocs;



index index.php index.html index.htm;


include common/wpfc-hhvm.conf;

include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/thauaneclaussen.com/conf/nginx/*.conf;

}`

Thanks you

@marcelloc You will need to change the website url from non-www to www in wordpress setting itself. In case if that breaks some elements of the website then you will have to perform a database search and replace. One tool that you can use for such task is wp-cli and the command will be like wp search-replace 'http://non-www url' 'http://www url' <your other parameters>

Let you know if this resolves your issue. Thank you

1 Like

Brilliant! Such a simple fix that I didn’t think of checking. Working now. Thank you very much mate!