react .htacess ignore react-i18next json translation files

Viewed 11

I have this .htacess to handle react-router, works great

<IfModule mod_rewrite.c>
  # react-router stuff
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
</IfModule>

but now I added react-i18next and the requests to the translation files return the index.html content

https://my-site/en.json returns the content of index.html

My hopefully temporary solution was to configure and manually move the translation files to the /static/ directory where the RewriteRule doesn't affect apparently.

But configuring it right would be best, making it work in the /public/ directory would be even better

0 Answers
Related