I have a .htaccess
file that redirects every requests to ./core/index.php
. But for static files which are in ./node_modules/
and ./assets/
folders, I want to enable normal redirect for them.
So,
url/whatever/page/
-> redirect to: core/index.php
url/assets/image/file.png
-> get: assets/image/file.png
url/node_modules/css/file.css
-> get: node_modules/css/file.css
My current code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ core/index.php [L,QSA]
I am not really sure what you mean by "I want to enable normal redirect for them" ... What you actually show as examples looks to me as if you do not want any rewriting or redirection to get applied at all for those two base paths. If so, then there are two alternatives for this:
Either use conditions:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/assets/
RewriteCond %{REQUEST_URI} !^/node_modules/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ core/index.php [L,QSA]
Or explicit exceptions:
RewriteEngine On
RewriteRule ^/?assets/ - [END]
RewriteRule ^/?node_modules/ - [END]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ core/index.php [L,QSA]