0

But except of api folder and index.html file? my folder:

api/
dist/
index.html

all css and js files in dist folder how to redirect all file requests to dist folder?

I tried this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^(.*) /index.html [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)$ /dist/$ [NC,L]

1 Answer 1

1

You may use these rules:

DirectoryIndex index.html
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^(?!dist/|api/).*$ dist/$0 [NC,L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.