无论 nginx 中的名称如何,所有位置路径的单个正则表达式?
a single regex for all location paths regardless of the name in nginx?
我们有一个 angular 应用托管在 nginx 上,它使用随机 url 路径。我正在尝试编写一个正则表达式来匹配它们,以将它们重定向到一个通用的 index.html 文件。
这意味着到
的所有流量
domain.com/abc
domain.com/xyz
应该全部转到 index.html 文件。
这是我一直在尝试的:
location ~* ^/[a-z](.+)$ {
rewrite ^ /index.html last;
try_files $uri $uri/ /index.html;
}
这行不通。请帮忙。
我们有一个 angular 应用托管在 nginx 上,它使用随机 url 路径。我正在尝试编写一个正则表达式来匹配它们,以将它们重定向到一个通用的 index.html 文件。 这意味着到
的所有流量domain.com/abc
domain.com/xyz
应该全部转到 index.html 文件。 这是我一直在尝试的:
location ~* ^/[a-z](.+)$ {
rewrite ^ /index.html last;
try_files $uri $uri/ /index.html;
}
这行不通。请帮忙。