I am learning AngularJs myself. Right now I am stuck on $locationProvider.html5Mode(true);.
On app.js file I have used this code.
angular.module('ContactsApp', ['ngRoute'])
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider
.when('/contacts', {
controller: 'ListController',
templateUrl: 'views/list.html'
})
$locationProvider.html5Mode(true);
}]);
On my window computer I have created virtual host using this code.
<VirtualHost *:80>
ServerName contacts.local
ServerAlias contacts.local
ServerAdmin webmaster@localhost
DocumentRoot D:/xampp/htdocs/angularJs/contacts/public
DirectoryIndex index.php index.html index.htm
<Directory "D:/xampp/htdocs/angularJs/contacts/public">
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Now issue is that when I try to open http://contacts.local/#/contacts that redirects to http://contacts.local/contacts. That is working fine.
But If I try to open http://contacts.local/contacts It shows me error 500 Internal Server Error.
Please guide me where I have doing wrong. Thanks in advance.