Skip to content

Instantly share code, notes, and snippets.

@jbutko
Created January 19, 2017 07:34
Show Gist options
  • Save jbutko/d2c625ee7f602dc6537c7d10da36dbd2 to your computer and use it in GitHub Desktop.
Save jbutko/d2c625ee7f602dc6537c7d10da36dbd2 to your computer and use it in GitHub Desktop.
AngularJS HTML5 mode / Apache config
# https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode
<VirtualHost *:80>
ServerName my-app
DocumentRoot /path/to/app
<Directory /path/to/app>
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]
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment