4

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?

daninthemix
  • 2,542
  • 8
  • 29
  • 40
  • 1
    Possible duplicate of [Redirect site with .htaccess but exclude one folder](http://stackoverflow.com/questions/3414015/redirect-site-with-htaccess-but-exclude-one-folder) – Matt S Jan 13 '17 at 16:16

1 Answers1

4

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]
daninthemix
  • 2,542
  • 8
  • 29
  • 40