我有一个在
运行的应用http://localhost/subfolder/myapp/
如何创建重写规则,以便将以下网址重定向到我的应用程序?
http://localhost/subfolder/myapp/route1
http://localhost/subfolder/myapp/route2
http://localhost/subfolder/myapp/routeN
...anyother routes after http://localhost/subfolder/myapp/
答案 0 :(得分:0)
添加此块nginx规则
location ~ /subfolder/myapp/.* {
redirect from here
}
答案 1 :(得分:0)
在Nginx中,您可以使用服务器块内的return
进行重写:
location ~ /subfolder/myapp/route(.*) {
return 301 http://localhost/subfolder/myapp;
}
答案 2 :(得分:0)
这似乎有效:
rewrite ^/subfolder/myapp/.+$ /subfolder/myapp last;