我试图重写下面的Nginx位置规则到一个位置块,但由于(。*)$它似乎是逃避我..
location ~ /admin { rewrite ^/admin(.*)$ /target.php last; } location ~ /index/ { rewrite ^/index/(.*)$ /target.php last; } location ~ /services/ { rewrite ^/services/(.*)$ /target.php last; } location ~ /test/ { rewrite ^/test/(.*)$ /target.php last; }
我以前能够使用正则expression式,但是无法得到符合上面的方法
location ~ /(someplace|other|another)
如果总是target.php(和$ 1?):
location ~ /(test|services|index)/ { rewrite ^/*/(.*)$ /target.php last; }