Prevent logged out users from accessing url links which are available for logged in users
===

I have done a login page by using session variable to store username based on which users are made to login, I would like to know whether it is possible to make url links which are accessible only for the logged in users, but the url links should not be available to users who are not logged in , for example a person who is logged in , if he tries to copy the url and give it to another person and if that person pastes the url in his address bar without logging in he should redirected to a login page or some message should be displayed saying that he needs to be logged in inorder to view that particular url link . 

I have searched in google regarding this , not able to find any solution.

Thanks 


