Forum Moderators: phranque
/index.html with a simple splash screen and html link to /forum
/forum/
I am about to do some development work and setup a CMS in the root folder and wanted to hide it from others while I develop the site.
I wanted to set it up so that any user apart from a list of 1 or 2 ip addresses would just get redirected to the following url /forum/
The list of users would be able to access the CMS installed in the root folder.
(I dont want to rewrite the content just redirect) my site can be found on both [site.com...] and [site.com...]
Is that possible to do in the .htaccess file?
If you can't do that, then I think you don't even need htaccess, through PHP or other scripting languages you can access a users IP, just make an array and if it doesn't match your IP array, redirect using header(); or equivalent in whatever scripting language you use.
I set my default document in Apache to be indexdev.php
And do some thing like this (I am not that hot with PHP) if some one could should me how to use an ARRAY this would be the basic code I guess.
Or is there a better what to do it?
<?php
$ip_dev_list=array(
"132.105.243.227",
"132.105.243.228",
"132.105.243.229"
);
if ( getenv("REMOTE_ADDR")!= in_array($ip_dev_list) )
header("Location: header("Location: [mysite.com...]
else
header("Location: [mysite.com...]
?>
[edited by: JamesTrix at 12:35 pm (utc) on Jan. 19, 2008]
# If not remote IP address 1
RewriteCond %{REMOTE_ADDR} !^24\.13\.0\.456$
# And if not remote IP address 2
RewriteCond %{REMOTE_ADDR} !^64\.35\.12\.890$
# Then redirect requests for anything except URLs in the /forum
# subdirectory to the home page of the /forum subdirectory
RewriteRule !^forum/ http://www.example.com/forum/ [R=301,L]
Jim