Created
November 13, 2014 19:55
-
-
Save dehuszar/68a18367f7e9fa6fb127 to your computer and use it in GitHub Desktop.
.htaccess for Ember-CLI builds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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> |
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 :).
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.
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
This works great, I wanted to note for anyone who has an app located in a sub directory on their server that they will have to include the subdir in the .htaccess file as well. So for example if you have a
config/environment.js
file with:then you would want to change your
.htaccess
to look like: