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. 腾讯应用宝官网-全网最新最热应用及游戏下载 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]

and

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>

Don’t work.

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

Regards, Clueless person.

I use this on Apache:

https://github.com/broerse/ember-cli-blog/blob/master/public/.htaccess

See:

http://exmer.com/bloggrcouch/

1 Like

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.

4 Likes