1

I am using angularjs with java tomcat i have an application that her base url is myapplication/app/index.html Everything works great when i use the # in the url When i try to switch to html 5 mode it goes crazy i added the base url meta tag but with no luck in every option i can with the entire path or with out <base href="index.html" /> and set up the configuration for the app as $locationProvider.html5Mode(true); nothing seems to help me any ideas ?

app code :

$locationProvider.html5Mode({ enabled: true, requireBase: false });

or

$locationProvider.html5Mode(true);

for the code base i tried every thing from

<base href="/" />

to

<base href="myappname/pathtofiles/" />
5
  • 1
    your base href should be <base href="/" /> Commented Jan 1, 2015 at 7:19
  • Tried it - it doesnt work all the js files and css can't be found Commented Jan 1, 2015 at 8:19
  • Can you post some html head code Commented Jan 1, 2015 at 8:24
  • you need to share relevant code Commented Jan 1, 2015 at 8:28
  • i added some more code :-) Commented Jan 1, 2015 at 8:43

1 Answer 1

1

Need that your server always returns index.html. For this purposes you can use, for example, Express server: http://www.seankenny.me/blog/2013/08/05/angularjs-in-html5-mode-with-expressjs/

If you use tomcat, maybe, one of them solutions will be useful for server side rewrites urls (with tomcat often use Apache Rewrites): https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode

Sign up to request clarification or add additional context in comments.

5 Comments

So you think its a server configuration issue ?
If you did not configure rewrites urls, you should obviously do this. It don't work without this.
This link: github.com/angular-ui/ui-router/wiki/…, how I wrote above, explains this.
What are you using as a development server?
I use tomcat 8 with spring restful server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.