0

I have a problem, I did remove #! in my URL with $locationProvider.html5Mode(true);. I checked my page is good if I switch in another page. But, if I reload my page like http://example-page/thread or http://example-page/answer. My page is 404 not found. I dont know what happened. Do you know ? Please give me solution. Thanks.

I use html 5 mode in config

$locationProvider.html5Mode(true);

This is my base href in index.html

<base href="http://project/admin/">

I use ui-sref

<li ui-sref-active="active">
                        <a ui-sref="home">
                            <i class="fa fa-home fa-3x" aria-hidden="true"></i>
                            <span class="title">Home</span>
                            <span class="selected"></span>
                        </a>
                    </li>
                    <li ui-sref-active="active">
                        <a ui-sref="thread">
                            <i class="fa fa-briefcase fa-3x" aria-hidden="true"></i>
                            <span class="title">Thread + Answer</span>
                            <span class="selected"></span>
                        </a>
                    </li>

This is my config

app.config(function(stateHelperProvider, $urlRouterProvider, $locationProvider) {

    $locationProvider.html5Mode(true);

    $urlRouterProvider.otherwise('/');

    stateHelperProvider        
        .state({
            name: 'home',
            url : '/',
            controller: 'admin-rv-controller',
            templateUrl: 'templates/home.html'
        })
        .state({
            name: 'thread',
            url : '/thread',
            controller: 'thread-controller',
            templateUrl: 'templates/table-thread.html',
        })
        .state({
            name: 'answer',
            url : '/answer/:id',
            params : {
                id  : null
            },
            controller: 'answer-controller',
            templateUrl: 'templates/table-answer.html'
        })
        .state({
            name: 'tag',
            url : '/tag',
            controller: 'list-tag-controller',
            templateUrl: 'templates/table-tag.html'
        })
        .state({
            name: 'form-tag',
            url : '/edit-tag/:id',
            params : {
                all : null,
                id  : null
            },
            controller: 'form-tag-controller',
            templateUrl: 'templates/form-tag.html'
        })
        .state({
            name: 'trending-tag',
            url : '/trending-tag',
            controller: 'list-trending-tag-controller',
            templateUrl: 'templates/table-trending-tag.html'
        })
        .state({
            name: 'form-trending-tag',
            url : '/edit-trending-tag/:id',
            params : {
                all : null,
                id  : null
            },
            controller: 'form-trending-tag-controller',
            templateUrl: 'templates/form-trending-tag.html'
        })
        .state({
            name: 'category',
            url : '/category',
            controller: 'list-category-controller',
            templateUrl: 'templates/table-category.html'
        })
        .state({
            name: 'form-category',
            url : '/edit-category/:id',
            params : {
                all : null,
                id  : null
            },
            controller: 'form-category-controller',
            templateUrl: 'templates/form-category.html'
        })
        .state({
            name: 'user',
            url : '/user',
            controller: 'user-controller',
            templateUrl: 'templates/table-user.html'
        });
2
  • how do you run the app? what http server are you using and what configs do you have there? Commented Feb 28, 2017 at 6:19
  • I just run with http://project/admin/. I edited my code, check my config Commented Feb 28, 2017 at 6:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.