Allow access to web pages only from within my website.

  • wpas
  • Proficient
  • Proficient
  • User avatar
  • Posts: 321
  • Loc: Canada

Post 3+ Months Ago

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
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

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?
  • wpas
  • Proficient
  • Proficient
  • User avatar
  • Posts: 321
  • Loc: Canada

Post 3+ Months Ago

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.
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 660
  • Loc: Conroe, Texas

Post 3+ Months Ago

well you can maybe do a account session via php.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 105 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.