Answer the question
In order to leave comments, you need to log in
Apache - mod_rewrite. Write a simple regex. Why does not it work?
OC ubuntu16.04-x86_64
Apache2.4
You need to write a regular expression on apache - mod_rewrite.
1. If the request starts with /api{whatever else}, then we will convert the request to index.php
2. In all other cases, we return index.html.
My version (below) doesn't work for some reason.
RewriteEngine on
RewriteRule ^api.*$ index.php [L]
RewriteRule ^.*$ index.html
Answer the question
In order to leave comments, you need to log in
The solution turned out to be this.
RewriteEngine On
RewriteCond %{ENV:REDIRECT_FINISH} !^$
RewriteRule ^ - [L]
RewriteRule ^api($|/+.*$) index.php [E=FINISH:1,L]
RewriteRule ^.*$ index.html [E=FINISH:1,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question