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.

Thanks.

Beattsme,

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.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.