title: How to rewrite url to use php script properly
body: <p>I have a php script that redirects external url, this is the script</p>
  
  <pre><code>&lt;?php
   header("Refresh: 5; url={$_GET['url']}"); 
   echo 'You are redirecting to ... page'; 
  ?&gt;
  </code></pre>
  
  <p>That redirects with this url</p>
  
  <blockquote>
    <p><a href="http://my-domain.com/url.php?url=http://www.google.com" rel="nofollow noreferrer">http://my-domain.com/url.php?url=http://www.google.com</a></p>
  </blockquote>
  
  <p>I wanted to rewrite this url with .htaccess so i added a code in my .htaccess file, this one</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^url/(.*)$ /url.php?url=$1 [L]
  </code></pre>
  
  <p>So after adding this code, it should redirect with this url</p>
  
  <blockquote>
    <p><a href="http://my-domain.com/url/?http://www.google.com" rel="nofollow noreferrer">http://my-domain.com/url/?http://www.google.com</a></p>
  </blockquote>
  
  <p>Script is working but it's not redirecting to external url, Just one message is appearing that is <strong>You are redirecting to ... page</strong> and it's just keep reloading the page at 5 seconds.</p>
  
  <p>So what's the problem? It's with the script or by .htaccess?</p>