bramus / router

A lightweight and simple object oriented PHP Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automatic redirect

philips81 opened this issue · comments

commented

Hi, when I log into the site
"http://myproject.it/" I would like the automatic redirect to the page "http://myproject.it/login" or "http://myproject.it/home", if the login has already been done or not,, but I don't understand which rule to use.
I use:
$router->before('GET|POST', '/.*', function() {
if (checksessionlogin()) {
go to home
}else{
go to login
}
});

Thanks

Use a regular header() redirect and exit.

commented

Hi,
thanks for the reply, but i can't access the rule.
It is completely ignored, but if I use "http://myproject.it/page", the rule is used.

thanks