wordpress - 未找到带有 Wordpress 子目录页面的 Nginx IFSC 代码脚本
问题描述
这是有效的
https://example.com/ifsc-code/index.php?bank=axis-bank&state=west-bengal&district=kolkata&branch=bally
这显示错误404
https://example.com/ifsc-code/axis-bank/west-bengal/kolkata/bally
我在 Nginx.conf 文件中使用此代码
location /ifsc-code {
try_files $uri $uri/ /index.php?$args;
rewrite ^/(.*)/(.*)/(.*)/(.*)/?$ /index.php?bank=$1&state=$2&district=$3&branch=$4;
rewrite ^/(.*)/(.*)/(.*)/?$ /index.php?bank=$1&state=$2&district=$3;
rewrite ^/(.*)/(.*)/?$ /index.php?bank=$1&state=$2;
rewrite ^/(.*)/?$ /index.php?bank=$1;
}
解决方案
我更改了代码,我的问题已经解决,希望对某人有所帮助。
location /ifsc-code {
root /var/www/example/ifsc-code;
index index.php index.html index.htm;
try_files $uri $uri/ @ifsc-code;
}
location @ifsc-code {
rewrite ^/ifsc-code/(.*)/(.*)/(.*)/(.*)/?$ /ifsc-code/index.php?bank=$1&state=$2&district=$3&branch=$4;
rewrite ^/ifsc-code/(.*)/(.*)/(.*)/?$ /ifsc-code/index.php?bank=$1&state=$2&district=$3;
rewrite ^/ifsc-code/(.*)/(.*)/?$ /ifsc-code/index.php?bank=$1&state=$2;
rewrite ^/ifsc-code/(.*)/?$ /ifsc-code/index.php?bank=$1;
}
推荐阅读
- javascript - 是否可以通过数组中的循环数据在 javascript 中创建一个对象?
- postgresql - Postgres Upsert - 碎片问题
- ios - iOS 13 中的 prefersStatusBarHidden 问题
- php - Laravel 使用 GuzzleHttp 发送 API 请求
- jenkins - 如何在 Jenkinsfile 中增加 NPM package.json 的版本
- python - 使用 fileinput 写入文件会产生问题
- oracle - ORA-00942: 表或视图不存在大量查询
- r-markdown - R markdown中插入的图像和标题之间的间距
- wso2 - WSO2 API Manager 3.0.0 中的相互 SSL
- selenium - Selenium XPath 查找同级