title: How would I redirect this?
body: <p>I have made a page where user can come and create a blog, an excerpt from <strong>creating a new blog</strong> page :-</p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;Blog URL&lt;/td&gt;
  &lt;td&gt;www.foo.com/blogs/ &lt;input type="text" name="ns"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Now, the user would enter something in that text box, suppose, the user enters <strong>foobar</strong>..then how can I make a setting a .htaccess so that the user can access that blog via <strong>www.foo.com/blogs/foobar</strong> instead of something www.foo.com/blogs.php?id=somethinghere ..</p>
  
  <p>How can this be accomplished?</p>
  
  <p>Thanks.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Thanks @anubhava for that htaccess code, but it doesn't seems to be working correctly, here's what I have right now.</p>
  
  <p><strong>blogs.php</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  include 'dbconnector.php';
  include 'functions.php';
  $owner=$_SESSION['username'];
  $id=$_GET['id'];
  
  $equery="select * from events where eventid = '" . $id . "'";
  $resulte=mysql_query($resulte) or die (mysql_error($db));
  $rowe=mysql_fetch_assoc($resulte);
  if((isset($_SESSION['logged'])) &amp;&amp; ($_SESSION['logged']==1))
  {
  ?&gt;
  
  Name : &lt;?php echo ($rowe['name']); ?&gt;
  Zipcode : &lt;?php echo ($rowe['zipcode']); ?&gt;
  &lt;?php
  }
  else
  {
      header('Location:/login/');
      exit();
  }
  ?&gt;
  </code></pre>
  
  <p>This code should've plucked up records for a blog with id something and then rewrite the url to www.foo.com/blogs/namehere if I directly open up www.foo.com/blogs/namehere</p>
  
  <p><strong>namehere</strong> is the name which the user has entered while creating a blog, but the only error I get is a 404 page not found.
  Really confused here, please explain how this is going to work.
  Thanks.</p>