Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear all

I removed # in angularjs application working fine. But when i am integrating codeigniter it is notworking. I want to remove index.php in codeigniter and remove # in angularjs also. Please guide me.

What I have tried:

Angular js Htaccess file :
------------------

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^(/index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule index.html [L]

Codeigniter Htaccess File :
------------------------

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

In codeigniter view : <base href='/'></base>

Angular App.js :
--------------

App.config(['$routeProvider','$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider.
when('/', {
templateUrl: 'views/home.html',
controller: 'HomeController'
}).
when('/menus', {
templateUrl: 'views/login.html',
controller: 'LoginController'
})

if(window.history && window.history.pushState){
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
}
}])


---
Thanks & Regards,
Siva.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900