javascript - Redirect to main page when comming from outside url angularJS -


i have angularjs routing:

angular.module('diam8app', ['ngroute']) .config(['$routeprovider','$locationprovider',   function($routeprovider,$locationprovider) {     $routeprovider.       when('/', {         templateurl: 'main.html'       }).       when('/calculator/', {         templateurl: 'calculator.html',         controller: 'calculatorctrl'       }).       when('/contact/', {         templateurl: 'contact.html',         controller: 'contactctrl'       }).       otherwise({         redirectto: '/'       });     $locationprovider.html5mode(true);   }]) 

everything works fine, when i'm trying subpage directly url, example mydomain.com/contact, i'm recieving http 502. think routing doesn't work, when accessing outside.

so question is: there way redirect user main page, when comes different page (routing main must work works now)? perhaps .htaccess or other angular configuration needed?

everything afther hash isn't taken in consideration server , angularjs handle that.

if use html5 mode, '#' prefix deleted.

the '#' deleted because of seo, can handled '!' prefix: $locationprovider.hashprefix('!');

when using html5mode, need take care of routes in backend!


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

javascript - Using jquery append to add option values into a select element not working -