Regular Expression for matching a url with a query string including a dot but not a URL for a static file?

I'm developing a Single Page App on the web and just found a exception when redirecting to index.html for all request except request to static files.

This is my current config

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

This matches everything that does not contain a '.' (period) and redirects the request to index.html.

The problem is if I request a URL like this.

www.example.com/test?q=include.period

It will not redirect this to index.html because it contains a dot in the query string, and it will think this is a static file with the document type .period.

I have tried to get a match on URL not containing a dot before any question mark, but can't get it working. It is hosted on NodeJS.

I'm not very good with regex so any help would be appriciated.

Examples

Should match

  • /test
  • /test/123
  • /test/123/1
  • /test/123/1?q=test
  • /test/123/1?q=test.period

Should mot match (file ending can be any type of file)

  • /test.js
  • /img/123.jpg
  • /script/app.js?version=1.0

Thanks

You could try the below regex,

\/[^.\n]*?(?:=.*)?$

DEMO