Page 1 of 1
www redirects to non-www
Posted: Sat Aug 25, 2018 4:31 pm
by Nitaro
Hi,
i´m running 0.9.8-22 on a Ubuntu 16.04.5 LTS (64) Server.
My question is the following:
I created a Web-Domain "example.com" with an alias "
www.example.com".
When i visit the Website using
http://www.example.com the url is rewrited to
http://example.com.
How can i change that the url is not rewriting to non-www ? Or did i made a mistake on creating the domain ?
I would be glad about the answer
Nitaro
Re: www redirects to non-www
Posted: Sat Aug 25, 2018 6:01 pm
by grayfolk
Use forum search. Learn about nginx/apache www/non-www redirecting.
Re: www redirects to non-www
Posted: Sun Aug 26, 2018 6:56 am
by mehargags
you may be having an .htaccess file in your site root which has the redirect rule.
Re: www redirects to non-www
Posted: Sun Aug 26, 2018 3:44 pm
by Nitaro
grayfolk wrote: ↑Sat Aug 25, 2018 6:01 pm
Use forum search. Learn about nginx/apache www/non-www redirecting.
I´ve tried, but check it on your own.
I didn´t have any content on it, no .htaccess or other.
Is it standard that there is no www and i have to do it manually or not ?
Thx
Nitaro
Re: www redirects to non-www
Posted: Mon Aug 27, 2018 11:05 am
by Nitaro
So, i figured out that this is caused by the force-https template.
Sorry, i forgot that i use it.
So i found in the force-https.tpl (/vesta/data/templates/web/nginx) the following line
Code: Select all
rewrite ^(.*) https://%domain_idn%$1 permanent;
and changed it to
Code: Select all
rewrite ^(.*) https://%alias_idn%$1 permanent;
To be safe, i´ve rebootet the server but the issue still exist.
It seems that changes on this file doesn´t work.
Is there another location where the template make changes ?
Re: www redirects to non-www
Posted: Mon Aug 27, 2018 11:44 am
by grayfolk
Make Rebuild Web after edit templates.
Re: www redirects to non-www
Posted: Mon Aug 27, 2018 11:56 am
by Nitaro
It works after rebuild!
Thank you grayfold.
Re: non-www redirects to www
Posted: Fri Aug 31, 2018 6:09 am
by gaddiprashanth
Hello, Now iam hosting a domain on vestapcp which is acessable in both versions like
www.domain.com and domain.com , i want to redirect site to
www.domain.com i have tried .htacess and it shows 500 error