1

我正在尝试在 nginx 中编写一个正则表达式,它将匹配/wp-admin/wp-admin/admin-ajax.php. 任何人都知道如何做到这一点?

4

2 回答 2

0

使用否定前瞻,您可以排除该特定站点:

^/wp-admin(?!/admin-ajax\.php)
于 2012-11-26T17:36:32.927 回答
0
location /wp-admin/ {
    # here is config for /wp-admin/* except /wp-admin/admin-ajax.php

    location = /wp-admin/admin-ajax.php {
        # here is config for /wp-admin/admin-ajax.php
    }
}

或者

location /wp-admin/ {
    # here is config for /wp-admin/* except /wp-admin/admin-ajax.php
}

location /wp-admin/admin-ajax.php {
    # here is config for /wp-admin/admin-ajax.php
}
于 2012-11-26T19:30:15.193 回答