
作为一名跨域设计师,除了会设计之外,能给自己做一个不错的博客,也是很有意思的,索性我几年前开启了自己的博客之路,而且连续更新三年,一直折腾各种博客程序和链接之间的问题,今天发现了一个优秀的跳转程序代码。

之前的代码
rewrite ^(.*) https://www.yangxulong.com$1 permanent;

现用代码
return 301 https://$server_name$request_uri;
效果如下

虽然实现的效果都一样,但是现用代码可以无关是否有别名,也就是说可以泛域名加https,比如*.yangxulong.com,都可以实现https://*.yangxulong.com,只需要在这里添加代码。
listen 80;
#listen [::]:80;
server_name www.yangxulong.com yangxulong.com *.yangxulong.com;
return 301 https://$server_name$request_uri;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.yangxulong.com;
以上就是我实现301跳转的所有技术细节,请笑纳。