I need to have Apache funnel all requests to the index.html file (excluding resource requests - js, css etc), but any requests into the /api folder need to be funnelled to the Laravel front controller: /api/public/index.php
Can anyone share their .htaccess knowledge with me to help accomplish this?
OK, got my answer. This is how to do it:
1 - send any requests into the /api folder to the Laravel front controller.
2 - send any other files beside that to the index.html file.
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/api/
RewriteRule (.*) /api/public/index.php [L]
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With