Verify URL to include metatags

0

I need to check the url of a site, if it is the same www.teste.com.br/agenda, the meta name="description" will be "blablabla", if it is www.teste .com / home will be "test". How do I check the URL?

    
asked by anonymous 26.07.2017 / 22:04

1 answer

1

Use the variable $_SERVER['REQUEST_URI'] , it takes the supplied URI to access the current page:

if ($_SERVER['REQUEST_URI'] == "/agenda"){
    echo"<meta name='description' content='Agenda Description'>";
}
else if($_SERVER['REQUEST_URI'] == "/home"){
    echo"<meta name='description' content='Guia de Caxias do Sul'>";
}
    
26.07.2017 / 22:20