wordpress - 冲突的 Nginx 重写规则
问题描述
寻找有关 Nginx 重写规则的帮助。我在同一台服务器上运行 Wordpress 和 MailWizz。Wordpress 安装在 root 中,MailWizz 安装在 root/mw 中。
WordPress 重写规则是:
## WordPress Perm links config ##
location / {
try_files $uri $uri/ /index.php?$args;
}
## Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
## Deal with sitemap wordpress plugin urls ##
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;
# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
MailWizz 重写规则是:
if (!-e $request_filename){
rewrite mw/customer/.* /mw/customer/index.php;
}
if (!-e $request_filename){
rewrite mw/backend/.* /mw/backend/index.php;
}
if (!-e $request_filename){
rewrite mw/api/.* /mw/api/index.php;
}
if (!-e $request_filename){
rewrite ^(.*)$ /mw/index.php;
}
每当我尝试将 WordPress 规则包含在 MailWizz 规则中时,都会导致 WordPress 永久链接出现问题。所以我正在寻找一种让两者共存的方法。它主要是破坏 WordPress 的 MailWizz 规则,MailWizz 继续正常工作。
有任何想法吗?
谢谢
解决方案
推荐阅读
- c# - 通过 Newtonsoft.Json.JsonConvert 从同一个类中序列化和反序列化
- python - 为什么不和seaborn一一了解剧情
- typescript - 如何将装饰器的应用限制在打字稿中的属性和方法上
- javascript - Math.random() 生成相同数量的Javascript
- sql - 从格式 yyyy_d_m 获取日期
- android - 让 android 项目在 Android Studio 4.2 中运行时出现问题
- c++ - 使用向量实现下一个组合 - C++ 上的 C_n_k
- c++ - 在 Multimap 中插入一个结构作为值并迭代它以获取值
- android - 谷歌地图改变了什么?我的应用程序在 2 天前工作,但现在没有工作
- r - 使用胶合语法和列操作 - dplyr