How to force SSL for one domain?
Posted: Tue Apr 14, 2015 8:47 pm
How to force SSL for one domain?
Community Forum
https://forum.vestacp.com/
There is simple way:mark wrote:What code of line should I add to the template to make all www-requests redirect to non-www as well?
Code: Select all
if ($http_host != "www.domain.ru") {
rewrite ^ http://domain.ru$request_uri permanent;
}
Code: Select all
server {
listen 80;
server_name example.com;
return 301 http://www.example.com$request_uri;
}
server {
listen 80;
server_name www.example.com;
...
}
Code: Select all
server {
listen 80;
listen 443 ssl;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen 80;
listen 443 ssl;
server_name example.com;
# rest goes here...
}
Omg ) I was too sleepy to write about second way.DFS wrote:using if - bad way
Code: Select all
# WP REWRITE LOOP START
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{SERVER_PORT} ^80
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule ^index\.php$ - [L]
Well done, man! ^_^webass wrote:EDIT: HAHAHA, that was it...I just followed the instructions and on the WEB I changed the Ngnx template to the new one.. Then it works...
You use some tricky htaccess or php with routing?linboxs wrote: I've follow instruction from this link: https://vestacp.com/docs/#how-to-force-https, i've change the proxy template to force-https but the web just loading and then shown this: The page isn't redirecting properly