This will be a bit long, but i hope to make myself clear. Please ask if i've not explained a point well enough.
Using the following structure/setup, i've h\got everything to work in all browsers except IE9. For anything below, i don't need to provide support; the problem therefore lies with EI9. I am not using UI-router.
Website URL
http://domainname
Internal page link 1
<a href="page1">page1</a>
- clicking on this should land me tohttp://domainname/page1
Internal page link 2
<a href="page2">page2</a>
- clicking on this should land me tohttp://domainname/page2
Base
<base href="/">
HTML5 mode enable
$locationProvider.html5Mode(true)
Relevant route config
.when('/',{
templateUrl : 'pages/homepage.html',
controller : 'homepageController'
}).when('/page1',{
templateUrl : 'pages/page1.html',
controller : 'page1Controller'
}).when('page2',{
templateUrl : 'pages/page2.html',
controller : 'page2Controller'
})
- PhP htaccess redirect
RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L]
- this is for when you go to the page directly, and not land on the index, thus not giving the routing mechanism a chance to take over
My IE9 problem
The above Website URL gets transformed into http://domainname/#/
- a /#/
gets inserted into the link - i want that gone because it causes the following issues:
- When accessing
<a href="page1">page1</a>
- the link i get sent to becomeshttp://domainname/#/page1
- but it load fine. The problem becomes evident when trying to access thepage2
page frompage1
- When accessing
<a href="page2">page2</a>
- the link i get sent to becomeshttp://domainname/#/page1/page2
, when it should at the very worst behttp://domainname/#/page2
- Angular adds the URL to the existing URL, as a sort of subroute. So on and so forth for other pages - the URL concatenates.
I'm thinking it's related to the fact that IE9 does not support HTML5 push/pop, which i'm guessing Angular uses. I'm not sure, i'm new to this. At the very least $locationProvider.html5Mode(true)
is what's bugging IE9, from what i can tell.
I am currently stuck and will appreciate any help on the matter.
EDIT: The answer below IS a workable solution and i'll accept it a "solved issue" answer after further investigation. If you have the same issue, use it.