Redirect after login to previous page
<p>I would like to know how I can redirect to any page after login I tried the codes below and they do not work I get an error saying redirected you too many times. How can I fix this?</p>

<p>This code is for my login page:</p>

<pre><code>&lt;?PHP
session_start();
$_SESSION['url'] = $_SERVER['REQUEST_URI'];

if (!(isset($_SESSION['email']) &amp;&amp; $_SESSION['email'] != '')) {

header ("Location: log-in/login");

}

?&gt;
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
</code></pre>

<p>This is for the page that gets redirected after login:</p>

<pre><code>&lt;?PHP

session_start();
if(isset($_SESSION['url'])) 
   $url = $_SESSION['url']; // holds url for last page visited.
else 
   $url = "http://torcdesign.com"; 

header("Location: http://torcdesign.com$url"); ?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Login&lt;/title&gt;
</code></pre>