Skip to content

Instantly share code, notes, and snippets.

@mcblum
Created September 26, 2016 17:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mcblum/ffdc8e37a9901f82970136ec9408cb5b to your computer and use it in GitHub Desktop.
Save mcblum/ffdc8e37a9901f82970136ec9408cb5b to your computer and use it in GitHub Desktop.
.htaccess config for Angular
#Angular rewrites
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# If the requested pattern is file and file doesn't exist, send 404.
# This fixes the issue with Angular being included more than once
# when you get the path of a component template wrong.
RewriteCond %{REQUEST_URI} ^(\/[a-z_\-\s0-9\.]+)+\.[a-zA-Z]{2,4}$
RewriteRule ^ - [L,R=404]
RewriteRule ^(.*) /index.html [NC,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment