I've got a situation where I don't want www to redirect to the domain, or the domain to redirect to www.

I looked around and found

remove_filter('template_redirect', 'redirect_canonical');

I added this to my functions file, but the site still redirects. I don't understand it enough to do anything about it.

My site is running nginx, and I thought maybe it was related to the config file there, but I didn't see anything.

Anywhere else I can look to fix this? Thanks Rich

  • I don't entirely understand your question. Are you trying to have your website show only example.com and not www.example.com? Please elaborate more so we better understand your situation and provide a quick solution. Commented Sep 15, 2016 at 18:15
  • If a user requests example.com, it I don't want it to redirect to www.example.com. Also, if a user requests www.example.com I don't want it to redirect to example.com. Commented Sep 15, 2016 at 21:15
  • What is your WordPress site set up using? The www or non-www? Commented Sep 16, 2016 at 23:02
  • The site is setup with site.com. One thing I cannot tell if its WordPress of if its Nginx doing the redirecting. In the Nginx config, I don't see anything for www or redirect. Commented Sep 16, 2016 at 23:09
  • 1
    I see. This would be on the hosting side then, look at your DNS settings for your domain and you will see that the www will be pointing to the same IP as your non-www. Commented Sep 16, 2016 at 23:16


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.