wintermeyer
wintermeyer

Reputation: 8318

How to configure the rootURL for the production environment?

I'd like to host an Ember app in the /blog/ directory. I found the following code in the documentation to make that happen but I have trouble to make it work.

App.Router.reopen({
  rootURL: '/blog/'
});

At what position do I have to include this code or is there a better way to do it anyway? I'd like to fire up ember build --environment=production and than copy /dist/* to the /blog/ directory on the webserver.

Upvotes: 0

Views: 1522

Answers (1)

Daniel
Daniel

Reputation: 18672

To do that, you should set baseURL in config/environment.js:

if (environment === 'production') {
  ENV.baseURL = '/blog/';
}

Also, if you encounter any issues with hash location setup or IE9 you could also use following code in app/router.js:

import Ember from 'ember';
import config from './config/environment';

let Router = Ember.Router.extend({
  location: config.locationType,
  rootURL: config.baseURL
});

Upvotes: 3

Related Questions