URL amigável PHP Htaccsess - Mais fácil de entender
Estou com problemas para fazer uma URL amigável e fiz um post mas ele está me confundindo pois o site está em uma área de testes e resolvi fazer outro com o mesmo exemplo porém, este está online já e se clicarem no link poderão ver como está... preciso entregar um trabalho para o cliente que utiliza o mesmo modelo de trabalho.
O tratamento das URL no htaccess não está em uma index que manda para uma outra pasta, está tudo na raiz da hospedagem....
Preciso que esse link: www.odontocentermg.com.br/especialidade.php?recordID=1
Fique assim: www.odontocentermg.com.br/especialidade/implante-dentario
**O link para a página está assim:** <a href="especialidade.php?recordID=<?php echo $row_rsEspecMenuTop['id_area']; ?>"</a>
Esse é o htaccess:
RewriteEngine On
RewriteBase /
ErrorDocument 404 /404.php
RewriteRule ^/?$ /index.php [NC,L]
RewriteRule ^institucional/?$ /institucional.php [NC,L]
RewriteRule ^contato/?$ /contato.php [NC,L]
RewriteRule ^confirmacao/?$ /confirmacao.php [NC,L]
RewriteRule ^duvidas/?$ /duvidas.php [NC,L]
RewriteRule ^especialidade/?$ /especialidade.php [NC,L]
Esse é o script que puxa o resultado no banco de dados:
<?php require_once('Connections/conex.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""){
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
$colname_DetailRS1 = $_GET['recordID'];
}
mysql_select_db($database_conex, $conex);
$query_DetailRS1 = sprintf("SELECT * FROM area WHERE id_area = %s", GetSQLValueString($colname_DetailRS1, "int"));
$DetailRS1 = mysql_query($query_DetailRS1, $conex) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($DetailRS1);
?>Discussão (2)
Carregando comentários...