Skip to content

Instantly share code, notes, and snippets.

@fairlane57
Last active December 16, 2015 16:18
Show Gist options
  • Save fairlane57/5461762 to your computer and use it in GitHub Desktop.
Save fairlane57/5461762 to your computer and use it in GitHub Desktop.
Concrete5 development redirect based on IP. Useful if you want to redirect site visitors while in development - while allowing clients etc to review without registering or logging in. Just edit your root index.php file
<?php $allow = array("91.91.91.91", "92.92.92.92"); # Add allowed IP address
if(!in_array($_SERVER['REMOTE_ADDR'], $allow) && !in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) {
header("Location: http://www.domain.com/whereveryouwant/index.html"); # your redirection url
exit();
} ?>
<?php
require('concrete/dispatcher.php'); # allowed ip addresses will just see the site as normal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment