Reputation: 1341
I am deploying a AngularJS web application on tomcat apache 7.0.76
I am deploying the app under the ROOT directory of the webapps
now whenever the URL is requested by the user i.e. www.mydomain.com , angular changes the directory to www.mydomain.com/#/ and any virtual sub-directory requested it will still be under the root (followed by the #). for an instance, if I clicked a link in the home page to enter faq page , it will take the user to something like www.mydomain.com/#/faq
now .. if user wants to access the faq page directly , he needs to enter the link as www.mydomain.com/#/faq and angular will know which template to load
so far no problem , now the issue when the user to access the page directly by entering www.mydomain.com/faq (without the #) , then the server returns that the page does not exist , because there is no physical page / directory called faq under the root
hence , what I am looking for , is there a possible way to check if the requested URL does not contain the # under the root to automatically add the # after the root. so if the user enters www.mydomain.com/faq it should re map it to www.mydomain.com/#/faq
Thank you
Upvotes: 2
Views: 102
Reputation: 2684
Tomcat Rewrite Valve should allow you to redirect requests similar to apache mod_rewrite.
Upvotes: 1