I have an application with routing on php. Here is the simple example:
$req=$_SERVER['REQUEST_URI'];
if(strpos($req, '/items/') === 0){
include __DIR__.'/../views/items/index.php';
} else{
include __DIR__.'/../views/login/index.php';
}
on each page (items and login) angularjs routing is used. And all works perfectly except IE9 and below. After page load, angular updates url and reloads the page for routing with hash navigation. And I get the following problem in IE:
- enter url = /items/23
- server returns page
items/index.php - AngularJS changes url to /#!/items/23
- Server cannot read data after hash symbol, and think that url is
/so it returns pagelogin/index.php
As result I cannot open the items page in IE. How can I fix problem? I used to make redirect on the event $routeChangeSuccess in IE, to add query parameters to read it on the server side, but the new version of angular routing put the query parameters after hash and they are cannot be read on the server side.
Angular location provider is $locationProvider.html5Mode(true).hashPrefix('!');