Return to Snippet

Revision: 17309
at August 31, 2009 19:20 by scopefragger

Initial Code

Initial URL

Initial Description
Sometimes you just need to mask a script or reject a user from a page this can be done effortlessly using a single line of code.  Header location will allow you to redirect a user quickly and without them having any control over the action.

A good example of this forced redirection is an “if” statement.   Here is a simple if statement using the header location.  If the users ip addres =  ’’ then they will be redirected to the wanted page, else they will be rejected and taken to another page such as a 401 or 403

<div>if ($ip_address==’’){ header('Location:'); 
header('Location: deny_acces.php '); 

Initial Title
Redirecting your users browser

Initial Tags
redirect, browser, user

Initial Language