Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

www site does not direct to non-www site #28

Open
nemoshub opened this issue Sep 14, 2015 · 2 comments
Open

www site does not direct to non-www site #28

nemoshub opened this issue Sep 14, 2015 · 2 comments

Comments

@nemoshub
Copy link

I have the problem when I install the whole setup everything works fine with the exception that it only works for the non-www sites which I used in the installation process. If I open the www.-version of a site it redirects to the first wordpress-site installed during the process but not to the non-www version.
There are various tutorials available like this one here https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-centos-7 on how to do a 301 redirect with nginx and I tried many different ways of redirecting but they either didn't work or even ended up in the server not functioning anymore.
I guess it is because of using varnish with nginx together it is more complicated that with nginx alone as it is outlined in this article: https://danielmiessler.com/blog/handling-redirects-with-varnish-and-nginx/
Could someone suggest a solution that works with this particular set-up?

@nemoshub
Copy link
Author

I could solve this issue with the answer given on that site: http://serverfault.com/questions/441966/how-to-redirect-from-www-to-non-www-varnish - however that seems to cause new problems with WP not functioning properly, e.g. WP logging out and not being able to upload files to the page. So I'm still looking for a better solution...

Update one day later: I have two installs of the hgv-deploy-full and got two different results: On the first install I couldn't get the varnish redirect to work, here I turned off varnish and did the redirect in nginx. If doing the redirect in nginx it is important to open two server codes in the /etc/nginx/sites-available/website.tld as described here: http://stackoverflow.com/questions/7947030/nginx-no-www-to-www-and-www-to-no-www?rq=1. Before I always tried to put the redirect and the other parts in one server code and that ended up in loop errors with the browser.
On the other install I got the varnish redirect working. Here it is important to note that zach's hgv install uses varnish 3 and not varnish 4. The error noted above with the problems with WP stemed from me using the code for varnish 4. These codes for varnish 3 worked well for me: http://docs.evine.co/redirect-www-to-non-www-in-varnish/

@danipolo
Copy link

hell... same problem here. Any help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants