I have made a page where user can come and create a blog, an excerpt from creating a new blog page :-
<tr>
<td>Blog URL</td>
<td>www.foo.com/blogs/ <input type="text" name="ns"></td>
</tr>
Now, the user would enter something in that text box, suppose, the user enters foobar..then how can I make a setting a .htaccess so that the user can access that blog via www.foo.com/blogs/foobar instead of something www.foo.com/blogs.php?id=somethinghere ..
How can this be accomplished?
Thanks.
Update
Thanks @anubhava for that htaccess code, but it doesn't seems to be working correctly, here's what I have right now.
blogs.php
<?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'])) && ($_SESSION['logged']==1))
{
?>
Name : <?php echo ($rowe['name']); ?>
Zipcode : <?php echo ($rowe['zipcode']); ?>
<?php
}
else
{
header('Location:/login/');
exit();
}
?>
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
namehere 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.