Allow access to web pages only from within my website.

  • wpas
  • Graduate
  • Graduate
  • User avatar
  • Joined: Jul 12, 2010
  • Posts: 214
  • Loc: Canada
  • Status: Offline

Post June 3rd, 2012, 7:49 pm

Hi All

When someone accesses my home page, there are various links they can press to access either an HTML page, PHP page or combination HTML and PHP page.

What I want to do is to allow access to these pages only if the links are clicked within my website.

The reason I want this is because I do not want someone to copy the URL and then be able to simply copy the URL into a browser and get direct access to this web page thus bypassing my home page.

I want to be able to put something on the webpages that detects if the request is coming from within my website and if it is not coming from somewhere within my website, an error or something would be given back to the one trying to directly access the web page.

If possible I would like to keep it simple without having to do any changes to .htaccess if at all possible, but will do so if it is the easiest way.

Thanks
http://www.schembrionics.com
The Ultimate Solutions Center
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 3rd, 2012, 7:49 pm

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post June 3rd, 2012, 8:20 pm

One thing you could do is look at the HTTP_REFERER variable, but that isn't reliable. Many antivirus programs and some browsers can block the passing of that variable. If you wanted to use that you could see the last page they were on and if it was on your website then you could allow access.

Another potential way would be for you to set a cookie when a user arrives on your website that expires after a given length of time. As long as they then browse another page of your website within that time frame you would allow access. If the cookie expired or was not set then you would using either PHP or an htaccess file to redirect the user back to your home page. This method isn't 100% reliable either.

Hopefully that has helped some, I would be curious the reason you want to block someone from reaching the inside of your website first?
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • wpas
  • Graduate
  • Graduate
  • User avatar
  • Joined: Jul 12, 2010
  • Posts: 214
  • Loc: Canada
  • Status: Offline

Post June 3rd, 2012, 9:20 pm

I have some special features that promote my website and so I want people to get to my home page first so that they can employ them. If they can go direct, then my website loses it promotional features as anyone can access them directly and so would lower my coverstion rating and ROI.
http://www.schembrionics.com
The Ultimate Solutions Center
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Joined: Jun 21, 2006
  • Posts: 487
  • Loc: Conroe, Texas
  • Status: Offline

Post June 13th, 2012, 7:48 pm

well you can maybe do a account session via php.
Thanks, Josh --DemonMaestro
www.LilNetwork.com
Fun Website www.ShoutsCloud.com

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 213 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.