We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
weird problem,,redirecting to www and https
weird problem,,redirecting to www and https
i'm redirecting non www to www using htaccess
it only redirects on homepage only.. when i type mydomain.com/suboage.html is not redirected to www.. how to redirect all subpage?
and the second redirecting to https using code
it only redircts on homepage only too..when i type mydomain.com/suboage.html is not redirected to https.. how to redirect all subpage?
Code: Select all
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
and the second redirecting to https using code
Code: Select all
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Re: weird problem,,redirecting to www and https
Hey lokali,
For the www redirect I have the following in .htaccess:
And for https I have on: /home/admin/conf/web/nginx.conf the following:
So the settings for the nginx.conf virtual host look like this:
EDIT: Make sure to restart nginx after applying the config
Hope that helps.
For the www redirect I have the following in .htaccess:
Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Code: Select all
return 301 https://$server_name$request_uri;
Code: Select all
server {
listen 192.168.1.150:80;
server_name localehost.com www.localehost.com;
error_log /var/log/apache2/domains/localehost.error.log error;
return 301 https://$server_name$request_uri;
...
Hope that helps.
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: weird problem,,redirecting to www and https
I have this htaccess:
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !localhost
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [L,R=301]
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
</IfModule>
Re: weird problem,,redirecting to www and https
please help me ..all don't work
actually the rediredtion works on domain.com/ but not work on domain.com/index.html and work for domain.com/page/ but not work on domain.com/page.html
so all my html page not redirected
i dont know what rule i should insert :(
i have tried all rule on google and not work for static .html :(
actually the rediredtion works on domain.com/ but not work on domain.com/index.html and work for domain.com/page/ but not work on domain.com/page.html
so all my html page not redirected
i dont know what rule i should insert :(
i have tried all rule on google and not work for static .html :(
Re: weird problem,,redirecting to www and https
i can confirm that this is BUG of vestaCP
i have the following htaccess code, my htaccess redirect non www to www and http to https that WORK redirection .html on MY CPANEL HOSTING but not work on vestacp..i have installed fresh vestacp and get the same problem. so this is vestacp problem
Vestacp htacess redirection:
actually the rediredtion works on domain.com/ but not work on domain.com/index.html and work for domain.com/page/ but not work on domain.com/page.html
on cpanel hosting:
the same htaccess code work to redirect http to https and non www to www on all pages .html
i have tried htaccess on vestacp doc and it also not work to redirect .html
if you have htacess redirection,,just double check if it work on static .html page or not
so this is bug of vesta cp, because of this problem i'm considering to find another control panel
i have the following htaccess code, my htaccess redirect non www to www and http to https that WORK redirection .html on MY CPANEL HOSTING but not work on vestacp..i have installed fresh vestacp and get the same problem. so this is vestacp problem
Vestacp htacess redirection:
actually the rediredtion works on domain.com/ but not work on domain.com/index.html and work for domain.com/page/ but not work on domain.com/page.html
on cpanel hosting:
the same htaccess code work to redirect http to https and non www to www on all pages .html
i have tried htaccess on vestacp doc and it also not work to redirect .html
if you have htacess redirection,,just double check if it work on static .html page or not
so this is bug of vesta cp, because of this problem i'm considering to find another control panel
Code: Select all
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Re: weird problem,,redirecting to www and https
If your problem is redirecting both yourdomain.com and www.yourdomain.com to https://www.yourdomain.com you have to follow the official guide at
https://vestacp.com/docs/#how-to-force-https
BUT THEN EDIT
/usr/local/vesta/data/templates/web/nginx/force-https.tpl
replacing all content with this:
You'll se that I changed only %domain_idn% with %alias_idn% in rewrite and include rules...
Remember to deselect, save, reselect and save again "force-https" as proxy template if you already installed and used it before... then restart both nginx and https.
Glad if this helps.
https://vestacp.com/docs/#how-to-force-https
BUT THEN EDIT
/usr/local/vesta/data/templates/web/nginx/force-https.tpl
replacing all content with this:
Code: Select all
server {
listen %ip%:%proxy_port%;
server_name %domain_idn% %alias_idn%;
location / {
rewrite ^(.*) https://%alias_idn%$1 permanent;
}
include %home%/%user%/conf/web/*nginx.%alias_idn%.conf_letsencrypt;
}
Remember to deselect, save, reselect and save again "force-https" as proxy template if you already installed and used it before... then restart both nginx and https.
Glad if this helps.