1

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:

modRewrite(['^[^\\.]*$ /index.html [L]'])

It's working beautifully, but now I need to update it so that it ignores that root-level api directory. My API calls look like this:

http://localhost:9000/api/customers/

They're all breaking because it's trying to route them through index.html. FYI, I'm using Grunt connect-modrewrite locally to manage issues with routing and localhost.

Brandon Durham
  • 7,096
  • 13
  • 64
  • 101

1 Answers1

1

You can try negative lookahead based regex:

modRewrite(['^(?!/?api)[^\\.]*$ /index.html [L]'])
anubhava
  • 761,203
  • 64
  • 569
  • 643