我正在尝试将目录/ members /和查询字符串?loggedout = true的所有流量重定向到主页。
以下是一个例子:
https://thebestsites.com/members/brian/settings/?loggedout=true
此网址应重定向到主页。我希望使用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;
}
答案 0 :(得分:0)
绝对可以使用nginx来满足您的所有重定向需求!
if ($arg_loggedout = true) {
rewrite ^/members/ / redirect;
}