Thursday, October 20, 2005

Restricted Site

The experimental scheme I used successful at .../fun is to use a html redirection file index.html

In there a redirection script like this is required

meta http-equiv="refresh" content="5; url=http://.../fun/index.php"

normally you also add below for the user to click if immediate redirection is desired

[FORM METHOD="LINK" ACTION="http://.../fun/index.php"]
[INPUT TYPE="image" SRC=".....jpg" "WIDTH="500" HEIGHT="332" ALT="a photo"]

In this case I have provided a image for user to click, if he/she can't wait

By having this file in the same folder as your index.php, the index.html takes over. You could then use .htaccess file to demand username and password login before the WordPress index.php is run.

The .htaccess file will look something like this

AuthName "Restricted Area"
AuthType Basic
AuthUserFile ".htpasswd file absolute folder path"
AuthGroupFile /dev/null
[files index.php]
require valid-user

Why do I need this workaround? It's because .htaccess doesn't get your username and password if index.php is your default file under that folder /fun, i.e. when users just typed in http://.../fun as url. By using index.html to redirect index.php gets executed and .htaccess takes over asking you to enter username and pwd. You can't expect visitors to type in http://.../fun/index.php do you?

No comments:

Post a Comment