# Redirect

**URL:** <https://forum.kirupa.com/t/redirect/229777>\
**Category:** Uncategorized\
**Created:** [June 20, 2007, 5:11am UTC](https://forum.kirupa.com/t/redirect/229777 "2007-06-20T05:11:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeltonnberg](https://avatars.discourse-cdn.com/v4/letter/j/a88e4f/32.png) [@joeltonnberg](https://forum.kirupa.com/u/joeltonnberg)\
**Post date:** [June 20, 2007, 5:11am UTC](https://forum.kirupa.com/t/redirect/229777/1 "2007-06-20T05:11:27Z")

</div>

How do I redirect a user to different pages depending on if a cookie is found  
or not? For example if I use the code below to check for a cookie, how do I  
redirect them to a certain URL instead of displaying a text.

\<?php  
if(isset([COLOR=red]$\_COOKIE[‘lastVisit’][/COLOR]))  
$visit = [COLOR=red]$\_COOKIE[‘lastVisit’][/COLOR];  
else  
echo “Welcome!”;

echo "Your last visit was - ". $visit;  
?\>
