Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DevWichrowski/265e4e59c97e73265d8e6d4cc49b5dfb to your computer and use it in GitHub Desktop.
Save DevWichrowski/265e4e59c97e73265d8e6d4cc49b5dfb to your computer and use it in GitHub Desktop.
React routing - to work
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment