Возможно этот способ будет делать нагрузку на Сервер, или в плане безопасности не очень надежен. А может и то и другое...
Файл .htaccess
#ЧПУ
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /full_news.php [L]
Таблица БД:
![user posted image](http://s020.radikal.ru/i705/1301/4a/eae7b8599a04.jpg)
<?php require_once('Connections/ConnectBank.php'); ?>
<?php
$result = $_SERVER['REQUEST_URI'];
if (preg_match ("/([^a-zA-Z0-9\.\/\-\_\#])/", $result)) {
echo "Недопустимые символы в URL";
exit;
}
$array_url = preg_split ("/(\/|\..*$)/", $result,-1, PREG_SPLIT_NO_EMPTY);
$sef_value = $array_url[0];
// в переменную $sef_value попадает адрес страницы.
mysql_select_db($database_ConnectBank, $ConnectBank);
$query_Recordset1 = "SELECT * FROM news WHERE url = '$sef_value'";
// В базе идет поиск $sef_value с адресом страницы чтобы вывести нужную Новость
$Recordset1 = mysql_query($query_Recordset1, $ConnectBank) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Новости</title>
</head>
<body>
<table width="80%" border="1" align="center">
<tr>
<td width="200"><a href="http://testphp/news.php">НОВОСТИ</a></td>
<td>Новость (<?php echo $row_Recordset1['title']; ?> )</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><?php echo $row_Recordset1['fulltitle']; ?></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>