开发者

What is the simplest way to restrict access to certain site pages?

I am looking at ways to restrict access to certain pages of a site for only a temporary period to allow only a certain subset of people.

I have the peoples email addresses and names.

I would much rather do this without the need for full fled开发者_运维百科ged sign ups.


The simplest way to restrict access to a directory under Apache is to use a Require directive. Here is a simple tutorial on how to set this up:

http://httpd.apache.org/docs/2.0/howto/htaccess.html#auth

Note that use of groups is not required, you could simplify to use only usernames:

AuthType Basic
AuthName "Password Required"
AuthUserFile /www/passwords/password.file
Require valid-user


The simplest way.... create a unique string that only you know. And do this:

if ( array_key_exists('MY SECRET_STRING',$_GET) ) // allow access

Then email users a URL like: http://www.example.com/?MY_SECRET_STRING

If you want to get fancier you can use a cookie to store it so it persists across pages.

Disclaimer: You asked for the easiest not the most secure. If anyone gets a hold of the URL with the key in it then they WILL be able to see your site.


  1. Create a TRULY RANDOM NAME folder
  2. Move the pages you want to this folder
  3. Send an email to those people with the link to the folder
  4. DO NOT add an entry in your robots.txt file
  5. Remove the folder after this "temporary period"
  6. DO NOT TELL ANYONE I TOLD YOU TO DO THIS!

P.S. security trough obscurity is highly discourage but in certain cases it's acceptable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜