Reputation: 2775
I am using LocationMatch
Apache directive to apply some logic to an AngularJS app. To test, I have the regex cover just one state, http://my.ui.com/login
Apache
<LocationMatch "^/(login)(.*)">
Redirect "/login" "/login2"
</LocationMatch>
This simple Redirect
is used to check if the block has been triggered. When I got to the URL above directly (fake URL, sorry I can't share the real app), I can see the redirect working by observing the URL bar. However, if I navigate to this state using a ui-sref
button, the LocationMatch block is never triggered. Here is the relevant AngularJS code, I am using the ui-router library:
UI State
$stateProvider.state('login', {
url: '/login',
templateUrl: 'login.html',
controller: 'LoginCtrl'
});
Button (clicking doesn't trigger Apache)
<button class="md-button" ui-sref="login">Login</button>
I'm guessing because the AngularJS app is loaded all at once, there is no disk read made when a stateChange occurs. Does anyone know of a better way for Apache to detect state changes in an AngularJS app?
Upvotes: 0
Views: 102