[英]nginx redirect based on specific query string
I am trying to redirect based on a specific query string: 我正在尝试根据特定的查询字符串进行重定向:
https://foo.com/wp-login.php?action=register to https://foo.com/account/ https://foo.com/wp-login.php?action=注册到https://foo.com/account/
location ~* /(wp-login\.php) {
if ($query_string = "action=register") {
rewrite ^ https://foo.com/account/ permanent;
}
limit_req zone=xwplogin burst=1 nodelay;
#limit_conn xwpconlimit 30;
auth_basic "Private";
#auth_basic_user_file /home/nginx/domains/foo.com/htpasswd_wplogin;
include /usr/local/nginx/conf/php-wpsc.conf;
# https://community.centminmod.com/posts/18828/
#include /usr/local/nginx/conf/php-rediscache.conf;
}
Try this: 尝试这个:
server {
# ...
rewrite ^/wp-login\.php\?action=register$ https://foo.com/account/ permanent;
# ...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.