Transwiki:Front door method

Defined: Programming: the act of forcing users to enter a website through one main portal or file, and preventing any access to other files in folders on any given site. This method does not prevent deep linking.

In PHP, for example, simply have a main file that initializes your script: index.php for example can use a switch to direct traffic: <?php //index.php define("IN_HOME",1); switch($_REQUEST['page']){ case 'article': require('article.php'); break; default: break; } Then in article php: <?php if(!defined("IN_HOME")) die('Front door only please.'); // article code here

If the user clicks: http://mypage.com/index.php?page=article&article_id=777

...they can view the article.

If they try to simply go right to the article page: http://mypage.com/article.php?article_id=777

They get the error: Front door only please.