regex - Rewrite except loading JS files
问题描述
In my nginx setting, I have the following rewritting
location ~* ^/1/\b(?!#|auth)\w+\b/? {
rewrite ^/1/(.*)$ https://www.funfun.io/1/#/$1 redirect;
}
As a result, www.funfun.io/1/home
will be rewritten to www.funfun.io/1/#/home
, which is what I want.
However, www.funfun.io/1/3.bundle.js
will be written to www.funfun.io/1/#/3.bundle.js
too, which is NOT what I want. I want to leave www.funfun.io/1/3.bundle.js
, more generally www.funfun.io/1/*.js
, as it is.
Does anyone know how to specify that in the nginx block?
解决方案
您可以在重写中排除序列。
像这样的东西应该工作:
rewrite ^/1/(.*[^.][^j][^s])$ https://www.funfun.io/1/#/$1 redirect;
推荐阅读
- android - 如何通过按下 Android 小部件中的按钮来更改 TextView 的文本
- python - 试图理解代码中的这一行
- python - python函数正在改变一个全局变量
- typescript - 映射类型和通用函数类型错误
- regex - 带有特殊字符 (@) 的 sed/perl
- ssl - HTTPS 使用 Poco C++ 获取 SSL 异常:OSM Nominatim
- angular5 - 我如何从循环数组中获取选择选项/索引的值到我的组件,以便我可以在我的 component.ts 中进行散文
- javascript - 使用 jQuery 在整个网站中搜索和替换字符串?
- sql - 取一个与某个参数匹配的值并将其复制到多行
- deep-linking - Waze 深层链接不适用于搜索词