title: htaccess redirection just if url has parameter
body: <p>I searched for it. But I couldn't find what I need.</p>
  
  <p>I have a url like</p>
  
  <blockquote>
    <p>mydomain.com/1hr6rry5</p>
  </blockquote>
  
  <p>Currently when a user clicks on this link he will go actually to </p>
  
  <blockquote>
    <p>mydomain.com/profile.php?id=1hr6rry5</p>
  </blockquote>
  
  <p>And if the url be like mydomain.com/ he will go to </p>
  
  <blockquote>
    <p>mydomain.com/home.php</p>
  </blockquote>
  
  <p>I mean when url has a parameter he goes to profile.php and when there is not a parameter he goes to home.php .</p>
  
  <p>By now I'm doing redirection with php, which looks so slow. I want to make it faster by doing it with htaccess.</p>
  
  <p>How can I do it?</p>
  
  <p>my htaccess</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^([^/\.]+)/?$ profile.php?id=$1 [L]
  </code></pre>
  
  <p>my index.php for redirection</p>
  
  <pre><code>&lt;?php
  
  if(empty($_GET['act_id']))
  {
      header('Location: home.php');
      exit();
  }
  
  header('Location: profile.php?id='.$_GET['act_id']);
  
  ?&gt;
  </code></pre>