location跳转和enable-php-pathinfo.conf冲突?
location /zrs/plu/qver/ {return 301 $scheme://$host/zrs/plu/wwqdc$request_uri;
}
我是想实现 /zrs/plu/qver/ 路径跳转到 /zrs/plu/wwqdc/
但是他就是不跳转,后来反复测试把 include enable-php-pathinfo.conf; 去掉就可以跳转,这应该怎么解决{:1_36:}
location ~ ^/zrs/plu/qver/ {
rewrite ^/zrs/plu/qver/(.*)$ /zrs/plu/wwqdc/$1 permanent;
}
不确定你具体配置有什么其他代码,可以尝试使用这个,放在root 行下面 licess 发表于 2023-12-22 08:52
不确定你具体配置有什么其他代码,可以尝试使用这个,放在root 行下面
感谢军哥帮忙,但是这样也是无效的。下面是我的完整代码
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name lihangz.cn www.lihangz.cn;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/lihangz.cn;
location ~ ^/zrs/plu/qver/ {
rewrite ^/zrs/plu/qver/(.*)$ /zrs/plu/wwqdc/$1 permanent;
}
ssl_certificate /home/ssl/lihangz.cn/9954750_lihangz.cn.pem;
ssl_certificate_key /home/ssl/lihangz.cn/9954750_lihangz.cn.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
if ($host != 'lihangz.cn'){
return 301 $scheme://lihangz.cn$request_uri;
}
if ($http_x_FORWARDED_PROTO = 'http'){
return 301 https://$host$request_uri;
}
if ($HTTP_TENCENT_ACCELERATION_DOMAIN_NAME = 'www.lihangz.cn'){
return 301 https://lihangz.cn$request_uri;
}
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php-pathinfo.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log/home/wwwlogs/lihangz.cn.log;
}
页:
[1]