Skip to content

Instantly share code, notes, and snippets.

@dvdopi
Created May 19, 2020 11:03
Show Gist options
  • Save dvdopi/b6af5b8c5230e7bb2677703886a8f92f to your computer and use it in GitHub Desktop.
Save dvdopi/b6af5b8c5230e7bb2677703886a8f92f to your computer and use it in GitHub Desktop.
Angular htaccess that eliminates 404 on page refresh or when accessing inner links
<IfModule mod_rewrite.c>
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html
# to allow html5 state links
RewriteRule ^ index.html [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment