Skip to content

Instantly share code, notes, and snippets.

@loursbourg
Last active February 16, 2021 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loursbourg/f7b082cd05e1e1d39094e227fc380e00 to your computer and use it in GitHub Desktop.
Save loursbourg/f7b082cd05e1e1d39094e227fc380e00 to your computer and use it in GitHub Desktop.
Apache .htaccess config for a React app with Laravel backend
# Assuming that your build lives in public/app/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /app/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /app/index.html [L]
</IfModule>
<VirtualHost *:80>
# SPA
# Assuming that your build lives in public/app/
# ... add this line to /path/to/vhost.conf
<Directory "/path/to/public/app">
AllowOverride All
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment