1
0
mirror of https://gitee.com/tawords/tawords-docs synced 2025-09-01 23:43:27 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

2021.08.18 small changes

This commit is contained in:
2021-08-18 23:36:42 +08:00
parent a3ac821d10
commit 9c900ecaad
3 changed files with 23 additions and 9 deletions

View File

@@ -19,22 +19,36 @@ location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project) #
> 2021.08.18更新
http跳转httpswww跳转@;访问二级域名指向网站的二级路径
http跳转https
```nginx
# http跳转https
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
```
www跳转@
```nginx
# $host = www.reciteword.com
# $1 = reciteword.com
# $request_uri = 请求参数
# return 301 https://reciteword.com$request_uri;
# 👇www跳转@
if ($host ~* "^www\.(.*?\..*?)$") # if ($host = 'www.reciteword.com')
if ($host ~* "^www\.(.*)$")
{
# $host = www.reciteword.com
# $1 = reciteword.com
return 301 https://$1; # https://reciteword.com$request_uri;
return 301 https://$1$request_uri;
}
```
-----
【以下弃用】
访问二级域名指向网站的二级路径纯静态网页可以PHP页面会出404 Not Found
```nginx
location ~ {
index index.php index.html index.htm;