Jump to content


.htaccess under construction page


3 replies to this topic

#1 Master Duckling

    Young Padawan

  • Members
  • Pip
  • 45 posts

Posted 28 January 2007 - 03:49 AM

Hi all!

I am totally new to .htaccess and stuff. But I heard it was possible to make an Under Construction page redirect for other people than me. So that I can work on my new website at the URl: www.duckz.nl/index.php but other people are being redirected to www.duckz.nl/underconstruction.html . It should be something with IP denying other IPs than mine...

Hope anyone can help me out with this!

Thanks,

~Ducky

#2 Mr. Matt

    Moderator

  • P2L Staff
  • PipPipPipPip
  • 1,945 posts
  • Gender:Not Telling

Posted 28 January 2007 - 05:29 AM

Hi

I am not sure if what you want done can be done via .htaccess, but can be done very easily with PHP. Make a new file and call it ipchecker.php. Then inside the file copy this code:

$allowed_ip = array('my.ip.address.here'); #Put all IP Adress you want to allow in here, multiple ones seperated by a comma, and IP needs to be encapsulated by either single or double quotes.

if (!in_array($_SERVER['REMOTE_ADDR'], $allowed_ip)) {
   header("location: www.duckz.nl/underconstruction.html");
}

Then you just include that file at the top of every page you want to protect and bingo you have protection.

Matt

#3 Master Duckling

    Young Padawan

  • Members
  • Pip
  • 45 posts

Posted 28 January 2007 - 05:43 AM

Thx man!

But is there a .htaccess way also?

#4 Master Duckling

    Young Padawan

  • Members
  • Pip
  • 45 posts

Posted 28 January 2007 - 06:07 AM

I read that tutorial already! But i cant manage to combine the IP ban and the Redirect together :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users