angularjs html5Mode on github pages
angularjs provides html5Mode, which makes your app use pushstate-based URL instead of hashtags. However this requires server side support, since the generated urls need to be rendered properly as well.
This actually works fine with github pages' custom 404 pages, though it's only available for custom domain enabled pages.
Simply copy index.html to 404.html, and add this to your app:
angular.module('app', []).config(function($locationProvider) {
$locationProvider.html5Mode(true);
});
Note that if you are on angular 1.1.5, make sure you set <base href="/"> for html5Mode to work properly.
Written by Chia-liang Kao
Related protips
2 Responses
So you're saying that if my repo uses a <username>.github.io/<repo> URL I'm out of luck?
But does the server response status say 404? If so, that's not good.
Have a fresh tip? Share with Coderwall community!
AngularJS pages are long-lived browser apps with the same script risk as a newer single-page app. Third-party code in the template can read forms and values rendered on the page.
Security insights from Cside