Skip to content

Instantly share code, notes, and snippets.

@dehuszar
Created November 13, 2014 19:55
Show Gist options
  • Save dehuszar/68a18367f7e9fa6fb127 to your computer and use it in GitHub Desktop.
Save dehuszar/68a18367f7e9fa6fb127 to your computer and use it in GitHub Desktop.
.htaccess for Ember-CLI builds
# place in [app]/public so it gets compiled into the dist folder
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@dirtyhenry
Copy link

dirtyhenry commented Jul 13, 2016

To build on @mrosata's comment, the .htaccess for a subdirectory can even be placed at the root of the subdirectory, as opposed to the root of the root directory, as weird as it sounds :).

@ve3
Copy link

ve3 commented Sep 21, 2016

I had modify a little bit.

<IfModule mod_rewrite.c>
    Options +FollowSymLinks

    RewriteEngine On

    # If you get 404 error, uncomment and change the line below.
    #RewriteBase /

    RewriteRule ^index\.html$ - [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.html [L]
</IfModule>

This is more flexible for me. It does not required to edit RewriteBase in every project.

@juliolopeztorres
Copy link

Thank you @ve3, it works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment