angular js 使用 codeigniter 作为辅助框架删除 # 标签

angular js remove # tag with using codeigniter as secondary framework

我在 angularjs 中使用了 codeigniter us 辅助框架。从 url 中删除 # 符号并成为 seo 友好网站的最佳方法是什么。 提前致谢。

在 angularjs 中使用位置提供程序并更改 css 和 js 的基本 href:

angular.module('scotchy', [])

.config(function($routeProvider, $locationProvider) {

    $routeProvider
        .when('/', {
            templateUrl : 'partials/home.html',
            controller : mainController
        })
        .when('/about', {
            templateUrl : 'partials/about.html',
            controller : mainController
        })
        .when('/contact', {
            templateUrl : 'partials/contact.html',
            controller : mainController
        });

    // use the HTML5 History API
    $locationProvider.html5Mode(true);
});

For more details about removing has tag

在application/config/routes.php中添加以下内容,防止404CI

$route[''] = "";

$route['about'] = "";

$route['contact'] = "";

编码愉快:)