I'm using Angular 1.5.0, angular-ui-router and Express.js.

I have two different problems and I believe that they're caused by the same issue, yet I couldn't solve.

They happen when I set html5Mode to true. Here's how I do it.

.config( ['$stateProvider', '$urlRouterProvider', '$locationProvider', function($stateProvider, $urlRouterProvider, $locationProvider) { $locationProvider.html5Mode({ enabled: true, requireBase: false }); );

Express.js code to be able to access url's manually

app.all('*', function(req, res){ res.sendFile(__dirname + '/public/index.html'); });

1-) If I try to access http://localhost/contacts or http://localhost/about , I am able do that. But if I try http://localhost/contacts/1 or http://localhost/contacts/1/item/a , I get a page like below.

2-) If I click Contacts > Alice (or any other) > Phone number (or any other list item), I get a duplicate of the navbar. Like below.

How can I solve it, and more importantly, what's causing this?

EDIT : If I change .html files to absolute urls (like /contacts.list.html ), it works well (so problem 2 was solved) but I still can't acess URL's manually, it tries to fetch wrong css/js files.

Here's the output (terminal). I also see Uncaught SyntaxError: Unexpected token < error for each .js file on the Chrome developer tools, so there's a problem.

GET /contacts/1/item/a 304 0.798 ms - - GET /contacts/1/item/bootstrap.min.css 304 1.828 ms - - GET /contacts/1/item/styles.css 304 1.798 ms - - GET /contacts/1/item/angular/angular-ui-router.js 304 4.444 ms - - GET /contacts/1/item/app.js 304 5.266 ms - - GET /contacts/1/item/contacts.js 304 7.612 ms - - GET /contacts/1/item/contacts-service.js 304 7.744 ms - - GET /contacts/1/item/utils-service.js 304 2.413 ms - - GET /favicon.ico 304 0.516 ms - -

EDIT 2 : If I change js and css path's to absolute paths, too, I can manually access URL's like http://localhost/contacts/1/item/a , but I don't want this. I like working with relative URL's.

Here's my plunk. (It's the sample app provided by ui-router team and I commented out html5 part in the app.js and contacts.js since plnkr doesn't offer server side rendering)

http://plnkr.co/edit/zm8v8VYSGzLbOzfcCB6O?p=preview

I tried to be as clear as possible, please feel free to add a comment if you want me to add something extra.