Regex Posted May 19, 2013 Share Posted May 19, 2013 I how a problem that if someone goes in myurl.../content.php he can see my content.php file but I would like that it could bee seen only when I include that in myurl.../index.php. How it could be done that if someone goes to myurl.../index.php/content.php he is redirected to error 404 but if I include that file somewhere then it does not redirecting. Quote Link to comment Share on other sites More sharing options...
kicken Posted May 19, 2013 Share Posted May 19, 2013 Have index.php define a constant, and inside content.php check if that constant has been defined. Of not, redirect. Index <?php define('IN_INDEX_PHP', true); include('content.php'); Content <?php if (!defined('IN_INDEX_PHP')){ header('Location: index.php'); exit; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.