【发布时间】:2016-07-05 11:57:03
【问题描述】:
我正在尝试将具有目录 /members/ 和查询字符串 ?loggedout=true 的所有流量重定向到主页。
这是一个例子:
https://thebestsites.com/members/brian/settings/?loggedout=true
此 URL 应重定向到主页。我正在寻找使用 WordPress 插件或 Nginx 来做到这一点......有什么想法吗?我在正确的地方发布了吗?
这不起作用:
server {
listen 80;
server_name thebestsites.com *.thebestsites.com;
return 301 https://thebestsites.com$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate /var/www/thebestsites.com/cert/thebestsites.com.crt;
ssl_certificate_key /var/www/thebestsites.com/cert/thebestsites.com.key;
server_name thebestsites.com www.thebestsites.com;
access_log /var/log/nginx/thebestsites.com.access.log rt_cache;
error_log /var/log/nginx/thebestsites.com.error.log;
root /var/www/thebestsites.com/htdocs;
location /members {
if($arg_loggedout = true) {
rewrite ^/members/ / redirect;
}
}
index index.php index.html index.htm;
include common/wpfc-php7.conf;
include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/thebestsites.com/conf/nginx/*.conf;
}
【问题讨论】:
-
当然,这是可能的。请发布您的 nginx 配置,以便我们提供答案
-
我投票结束这个问题,因为提问者不知道如何使用 systemd(请参阅他的 cmets)。