Re: How to Force user to start with Homepage(PHP3)
| From: | Chris Monson | Date: | Wed, 02 Aug 2000 19:37:46 +0000 |
| Subject: | Re: How to Force user to start with Homepage(PHP3) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9801@lists.php.net to get a copy of this message | ||
This is easy to do with PHP, if you include a small amount of code at the beginning of each file:
<?
if ($HTTP_REFERER != 'my.domain.com') {
header( "Location: /index.html" );
exit;
}
?>
That should work. If it doesn't, there is probably something wrong with my location header, since I haven't used it like that for a while. In fact, I haven't tried doing Location headers at all in PHP, but that is basically what you want.
Here's the idea behind it. If someone is coming to your site by punching in a URL, the $HTTP_REFERER will be blank. If they come to your site by clicking on a link, the $HTTP_REFERER will be whatever domain the link was on. If that domain is not yours, then you redirect them to your home page. Otherwise, the file is parsed normally.
Chris
kanojiajogesh@yahoo.com ("Kanojia Jogesh") wrote:
Hi There I want to know , How should i can force a user to start visiting my site with homepage only even if he enter any other file name I am using PHP3 amd MySql Please Help me Out Waiting for the reply Regards :-) Kanojia Jogesh(Senior Web Developer) (For ASP & PHP3) IG Technologies Ltd. We are in Web Development and B2B Solution provider