[英]Routing all traffic through index.html except 'api'
Working on a BackBone app that has this mod_rewrite
in place to handle routing all traffic through index.html that isn't targeting a file: 正在具有此
mod_rewrite
的BackBone应用程序上工作,以处理通过不以文件为目标的index.html路由所有流量:
modRewrite(['^[^\\\\.]*$ /index.html [L]'])
It's working beautifully, but now I need to update it so that it ignores that root-level api
directory. 它运行良好,但是现在我需要对其进行更新,以使其忽略该根级
api
目录。 My API calls look like this: 我的API调用如下所示:
http://localhost:9000/api/customers/
They're all breaking because it's trying to route them through index.html. 它们都中断了,因为它试图通过index.html路由它们。 FYI, I'm using Grunt
connect-modrewrite
locally to manage issues with routing and localhost. 仅供参考,我在本地使用Grunt
connect-modrewrite
来管理路由和本地主机的问题。
您可以尝试基于负前瞻的正则表达式:
modRewrite(['^(?!/?api)[^\\.]*$ /index.html [L]'])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.