Skip to content

Instantly share code, notes, and snippets.

@Edlavio
Created February 9, 2024 10:42
Show Gist options
  • Save Edlavio/2cb8bab001c8278bfa202497f23bd5ab to your computer and use it in GitHub Desktop.
Save Edlavio/2cb8bab001c8278bfa202497f23bd5ab to your computer and use it in GitHub Desktop.
Solves the problem of multi routes or dynamic routes that more robust servers have when deploying projects with React
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment