Hey,
I want to change from this address:
www.domain.com/game.php?id=1
to somthing like that:
www.domain.com/game/1/THE-NAME-OF-THE-GAME-IN-DB
How can I do it?
And one more question:
I want when the user goes to address which doesnt exists, for example if it doesnt exists:
www.domain.com/game.php?id=9123912 - this ID doesnt exists
The server will pass him to 404 error. How can I do it?
Thank you very much.
EDIT:
game.php:
if (isset($_GET['id'])) {
$row = mysql_num_rows(mysql_query("SELECT * FROM games WHERE id = '{$_GET['id']}'"));
if ($row) {
$game = mysql_fetch_array(mysql_query("SELECT * FROM games WHERE id = '{$_GET['id']}'"));
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: /game/".$game['id']."/".seo_title($game['name']));
}
else {
Header( "HTTP/1.1 404 Not found" );
}
exit;
}
htaccess:
LIKE YOU SAID. I JUST COPIED.