If tabs loads by ajax try that
when session expires you would send code 403 Unauthorized (in script.php)
Globaly set:
$(function(){
$.ajaxSetup({
statusCode: {
403: function() { location.assign('/auth/'); }
}
});
});
if ajax response returns 403 then javascript code redirect from curret page to page '
http://myhost.com/auth/'
or change location.assign('/auth/'); to location.assign('/'); to redirect to site root
Also i not recommend use redirect in scripts wich generates ajax content, some browsers follows redirect and loads content from there.
(like in you case)
By example
Without redirect
ajax.get('/somepage/')
-> GET /somepage/ <- 200 OK, Content, Return content /somepage/
ajax.get('/somepage/')
-> GET /somepage/ <- 302 Moved temprary, Location: /otherpage/
-> GET /otherpage/ <- 200 OK, Content, Return content /otherpage/