How can I redirect to home when user click on back button after logout?
I was wondering how can I redirect 开发者_如何学运维users to my hompage after they logged out when they hit the back button, kind of like facebook does. I was playing around with some javascript but nothing seemed to work.
PS: This will be for a Wordpress theme.
Hi there check the wp_logout_url($redirect_url).
If you use sessions, you can check if the user is logged in when viewing an authenticated page, and if not, send the headers to your homepage.
Javascript seems like the way to do it. Simply check if the user is logged and if not, do a redirect to the home page via a document.location = "http://my.home.page";
I guess that you have the session in PHP too so you could just do the redirect there instead of relying on Javascript.
header ('Location: http://your.home.page');
精彩评论