2019-12-24 08:44:33 0 Comments Nginx Boy.Lee

Nginx Auto Redirect from http to https

Sometime, we change from http to https, but still have old use or search engine are still using the old http url, so we need create a redirect code to force user using the https, it's also necessary to tell the search engine we are using https now, follow is the nginx config code

 

{ Nginx Config }

server {
    listen 80;
    server_name iproject.yiilib.com ieve.yiilib.com;
    access_log  /eebox/logs/wwwLogs/http_to_https_redirect.access.log ;

    return 301 https://$host$request_uri;
    
    location / {
    }
}