0

I have deployed angular app in tomcat7.

What did :

      1 Made angular app as an html5 mode to true by adding  fallowing code in app.js

      if (window.history && window.history.pushState) {
            $locationProvider.html5Mode(true);
        };



      2. Added  `<base href="/dist/#/">` in index.html 

      2. Build the app by using grunt `grunt build`

      3. Kept the dist into the folder `TOMCAT_HOME/webapp/ROOT`  

Problem :

  1. When i refresh the page it show 404
  2. When I copy the URL and paste then also it's giving 404 error.
  3. Provide me link for tomcat configurations

Note : If i hit the browser with Host/dist app is running (if i navigate state by state).

Please help me where i did mistake. And how to resolve it (with tomcat sever configuration if required).

URL's I fallowed :

  1. Deploy AngularJS app on tomcat
  2. http://diveintohtml5.info/examples/history/fer.html
  3. Removing the fragment identifier from AngularJS urls (# symbol)
Community
  • 1
  • 1
Ramesh Papaganti
  • 7,311
  • 3
  • 31
  • 36

1 Answers1

0

Not sure if you are still looking for the answer, but I will share my solution in case anyone needs it.

What I did was basically use http://tuckey.org/urlrewrite/ and set the rule as

<rule>
<from>^/search/$</from>
<to>index.html</to>
</rule>

I want to point out that I used the actual file name instead of the url I want to go.

Hope this helps!

Regards,

Berkan

archeios
  • 1
  • 1
  • 1