1

The website working fine with ngRoute on http://www.athimannil.com/ but unfortunately page http://www.athimannil.com/about not working when refresh URL :(

is there anything extra need to add in the JavaScript code ?

var app = angular.module('app',['ngRoute']);
    app.config(function($routeProvider, $locationProvider) {
        $locationProvider.html5Mode(true);
        $routeProvider
            .when('/', {
                templateUrl: 'home.html',
                controller: 'homecontroller'
            })
            .when('/about', {
                templateUrl: 'about.html',
                controller: 'aboutController'
            })
            .when('/portfolio', {
                templateUrl: 'portfolio.html',
                controller: 'portfolioController'
            })
            .when('/contact', {
                templateUrl: 'contact.html',
                controller: 'contactController'
            })
            .when('/cv', {
                templateUrl: 'cv.html',
                controller: 'cvController'
            })
            .otherwise({
                redirectTo: '/'
            });
    });

.htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Mo.
  • 26,306
  • 36
  • 159
  • 225
  • This is due to complications with html5mode, check it out here: http://stackoverflow.com/questions/19211576/enabling-html-5-mode-in-angularjs-1-2 – Ben Black Dec 17 '14 at 22:25
  • It may help if you just put `about.html` in a directory like `/partials/about.html`. – Dylan Dec 17 '14 at 22:32
  • @Dylan Just made the change like you mentioned. Still the same error occur :/ – Mo. Dec 17 '14 at 22:54

1 Answers1

1

by default angular uses routes like .../#/...

if you want to remove that you need some server configurations

AngularJS routing without the hash '#'

Community
  • 1
  • 1
bto.rdz
  • 6,636
  • 4
  • 35
  • 52