Hi, not sure if this is the right area.

I want to control where my visitors are coming from.
So not visiting from google or their homepage etc etc. i want them to enter the site from one specific site.


8 Years
Discussion Span
Last Post by Airshow


You could inspect javascript's History object but whatever you wrote could be defeated. Reason being that (a) the page would always be served in its entirity (though not necessarily rendered) and (b) in most browsers, javascript can be turned off. In short, javascript executes too late to reliably suppress a page on the basis of its own contents.

A much better bet is to perform the check server-side, before the page is served. Most server-side scripting languages give access to the referring url, which is included in each HTTP request. In php for example, you can test $_SERVER. If this url is not the one(s) you expect, then you can forward to an error page or whatever you want.

I have never needed to do this but far as I know the server-side approach should be reliable. Maybe someone out there has first hand experience.


Edited by Airshow: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.