Rommeo Posted December 6, 2010 Share Posted December 6, 2010 I have my template files and some functions in my server which are available for direct reach. like ; my "index.php" file includes "loginpage.php" form which is ok when I enter www.site.com/index.php but also when I enter to www.site.com/loginpage.php it works and shows me just login page. So this is what I dont want. How can I prevent to reach the files directly like this, I want them to work just for other pages of my website, not for directly seeing. By the way can this problem also be solved by hosting settings or mod_rewrite ? Link to comment https://forums.phpfreaks.com/topic/220836-how-to-prevent-direct-reach/ Share on other sites More sharing options...
AbraCadaver Posted December 6, 2010 Share Posted December 6, 2010 This can be solved by htaccess rules but here is one common way: //index.php define('SOMETHING', true); //loginpage.php defined('SOMETHING') or die(); //or defined('SOMETHING') or header('Location: index.php'); Link to comment https://forums.phpfreaks.com/topic/220836-how-to-prevent-direct-reach/#findComment-1143614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.