Ember/ember-cli and Apache


Hi Guys,

I’m running into a problem when I try to serve my ember app through Apache. Because the location is set to "history" and not “hash”, Apache is trying to load the magic ember routes which don’t exist as files. myapp.com/login throws a 404 because there is no login.html.

I’ve done a bit of scouring and its surprising that there isn’t much on this which leads me to believe that not many people deploy ember apps on apache.

So it’s suggested I write Apache URL Rewrite rules, but the one’s I have tried don’t seem to be working.

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.html [L]


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]

Don’t work.

Does anyone have any idea of what to do other than go back to “hash”?

Regards, Clueless person.

Apache htaccess for ember
How to I redirect /index.html
Apache htaccess for ember

I use this on Apache:




URL Rewriting using .htaccess on Apache2 server

Given recent versions of Apache, you can use this handy configuration value:

FallbackResource /index.html

basically, whenever a file is not found, it will send the client to index.html. This helps for ember paths (which correspond to the index.html not actual files) when individuals’ refresh their browser.