Nikolay Melnikov Nikolay Melnikov - 1 year ago 90
AngularJS Question

ui-router returns: "Cannot GET /page"

I am using

, and have a
state that looks as follows:

.state('profile', {
url: "/profile",
templateUrl: "views/profile.html",
controller: 'ProfileCtrl',
resolve: {
currentUser: function(gamAuth){
return gamAuth.checkCurrentUser(config.userRol.user)

When I try to reload/refresh the page I get the following message:

Cannot GET /profile

The problem does not occur when I reload my 'landing page' at:
, which has the following state in

.state('home', {
url: "/",

I am using:

I tried providing absolute URL as suggested in the Decision Tree here

I also tried a number of suggestions found online, the most popular being something along these lines (placing it in the

$state.transitionTo($state.current, $stateParams, {
reload: true,
inherit: false,
notify: true

All approaches were tested with and without the
<base href="/">
tag being present in the
of my
Thank you for your time.

Answer Source

you need to enable html5mode to true if you want to use your url without '#' prefix.

Also you need to add your modRewrtie in as mentioned here


npm install --save-dev connect-modrewrite
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download