How to make page title with php

0

How can I make this code work as follows, it works by getting the address of the site / media / movies / and the GET's to get the url

ex: link link

I would like to make it work by staying like this

ex: link link

So that he knows to recognize that 1 URL and averages and 2 URL and movie thus making their corresponding titles appear without the need to have media / or movies / in the URL.

<?php //
//
//
// DESCRIÇÃO DA LISTA DE MEDIAS INICIO
$uri = $_SERVER['REQUEST_URI'];
if (strpos($uri, 'media/'.$_GET['media_categoria_url'].'/'.$_GET['media_subcategoria_url'].'/')){
$select1 = mysql_query("SELECT * FROM 'media_categoria' WHERE 'media_categoria_url'='".$_GET["media_categoria_url"]."'");
$dados = mysql_fetch_array($select1);
$select2 = mysql_query("SELECT * FROM 'configuracoes' WHERE 'funcoes'='dados'");
$dados2 = mysql_fetch_array($select2); ?>
<title><?php echo $dados2["site_titulo"]; ?> - <?php echo $dados["nome"]; ?></title>
<meta content='<?php echo $dados["site_keys"]; ?>' name='keywords'/>
<meta content='<?php echo $dados["site_descricao"]; ?>' name='description'/>
<? } // DESCRIÇÃO DA LISTA DE MEDIAS FIM
//
//
//

//
//
//
// DESCRIÇÃO DA LISTA DE MEDIAS INICIO
$uri = $_SERVER['REQUEST_URI'];
elseif (strpos($uri, 'filmes/'.$_GET['filmes_categoria_url'].'/'.$_GET['filmes_subcategoria_url'].'/')){
$select1 = mysql_query("SELECT * FROM 'filmes_categoria' WHERE 'filmes_categoria_url'='".$_GET["filmes_categoria_url"]."'");
$dados = mysql_fetch_array($select1);
$select2 = mysql_query("SELECT * FROM 'configuracoes' WHERE 'funcoes'='dados'");
$dados2 = mysql_fetch_array($select2); ?>
<title><?php echo $dados2["site_titulo"]; ?> - <?php echo $dados["nome"]; ?></title>
<meta content='<?php echo $dados["site_keys"]; ?>' name='keywords'/>
<meta content='<?php echo $dados["site_descricao"]; ?>' name='description'/>
<? } // DESCRIÇÃO DA LISTA DE MEDIAS FIM
//
//
// ?>
    
asked by anonymous 23.01.2015 / 22:33

1 answer

0

A good solution to what you want, would be to use a friendly url.

No doubt it would be a solution for what you want and you can use the apache url rewrite module to do this.

Since the subject is a bit extensive, it follows a support link that will help you in this solution: Apache Official Documentation

    
29.01.2015 / 17:14