Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

www redirects to non-www

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
8 posts • Page 1 of 1
Nitaro
Posts: 7
Joined: Sat Aug 25, 2018 4:22 pm

Os: Ubuntu 15x
Web: apache + nginx
www redirects to non-www
  • Quote

Post by Nitaro » Sat Aug 25, 2018 4:31 pm

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
Top

grayfolk
Support team
Posts: 1111
Joined: Tue Jul 30, 2013 10:18 pm
Contact:
Contact grayfolk
Website Facebook Skype Twitter

Os: CentOS 6x
Web: nginx + php-fpm
Re: www redirects to non-www
  • Quote

Post by grayfolk » Sat Aug 25, 2018 6:01 pm

Use forum search. Learn about nginx/apache www/non-www redirecting.
Top

mehargags
Support team
Posts: 1096
Joined: Sat Sep 06, 2014 9:58 pm
Contact:
Contact mehargags
Website Skype

Os: Debian 8x
Web: apache + nginx
Re: www redirects to non-www
  • Quote

Post by mehargags » Sun Aug 26, 2018 6:56 am

you may be having an .htaccess file in your site root which has the redirect rule.
Top

Nitaro
Posts: 7
Joined: Sat Aug 25, 2018 4:22 pm

Os: Ubuntu 15x
Web: apache + nginx
Re: www redirects to non-www
  • Quote

Post by Nitaro » Sun Aug 26, 2018 3:44 pm

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
Top

Nitaro
Posts: 7
Joined: Sat Aug 25, 2018 4:22 pm

Os: Ubuntu 15x
Web: apache + nginx
Re: www redirects to non-www
  • Quote

Post by Nitaro » Mon Aug 27, 2018 11:05 am

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 ?
Top

grayfolk
Support team
Posts: 1111
Joined: Tue Jul 30, 2013 10:18 pm
Contact:
Contact grayfolk
Website Facebook Skype Twitter

Os: CentOS 6x
Web: nginx + php-fpm
Re: www redirects to non-www
  • Quote

Post by grayfolk » Mon Aug 27, 2018 11:44 am

Make Rebuild Web after edit templates.
Top

Nitaro
Posts: 7
Joined: Sat Aug 25, 2018 4:22 pm

Os: Ubuntu 15x
Web: apache + nginx
Re: www redirects to non-www
  • Quote

Post by Nitaro » Mon Aug 27, 2018 11:56 am

It works after rebuild!
Thank you grayfold.
Top

gaddiprashanth
Posts: 1
Joined: Fri Aug 31, 2018 5:41 am

Os: Ubuntu 15x
Web: apache + nginx
Re: non-www redirects to www
  • Quote

Post by gaddiprashanth » Fri Aug 31, 2018 6:09 am

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
Top


Post Reply
  • Print view

8 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password